[Commits] 785fc4acd03: MDEV-27776: Make EXPLAIN show filtered and partitions column
revision-id: 785fc4acd0346f96248d9cd0643dbf0faac7ddb8 (mariadb-10.6.1-364-g785fc4acd03) parent(s): 27e74f54ec63623065aaf840517c6f92ac5d52a8 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2022-03-18 16:47:42 +0300 message: MDEV-27776: Make EXPLAIN show filtered and partitions column Add "filtered" column, update the results --- mysql-test/include/index_merge_ror_cpk.inc | 7 + mysql-test/main/analyze_stmt.result | 22 +- mysql-test/main/analyze_stmt_orderby.result | 32 +- mysql-test/main/analyze_stmt_privileges2.result | 762 +++---- mysql-test/main/aria_icp_debug.result | 4 +- mysql-test/main/binary.result | 8 +- mysql-test/main/column_compression_parts.result | 8 +- mysql-test/main/compare.result | 12 +- mysql-test/main/compress.result | 172 +- mysql-test/main/create.result | 4 +- mysql-test/main/cte_nonrecursive.result | 310 +-- mysql-test/main/cte_recursive.result | 176 +- mysql-test/main/ctype_binary.result | 8 +- mysql-test/main/ctype_collate.result | 48 +- mysql-test/main/ctype_cp1251.result | 8 +- mysql-test/main/ctype_latin1.result | 8 +- mysql-test/main/ctype_uca.result | 92 +- mysql-test/main/ctype_uca_innodb.result | 28 +- mysql-test/main/ctype_ucs.result | 60 +- 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 | 142 +- 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/delete.result | 8 +- mysql-test/main/delete_innodb.result | 6 +- mysql-test/main/derived.result | 280 +-- mysql-test/main/derived_cond_pushdown.result | 1448 ++++++------- mysql-test/main/derived_opt.result | 276 +-- mysql-test/main/derived_split_innodb.result | 104 +- mysql-test/main/derived_view.result | 694 +++---- mysql-test/main/desc_index_range.result | 32 +- mysql-test/main/desc_index_range.test | 1 + mysql-test/main/distinct.result | 190 +- 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 | 32 +- mysql-test/main/except_all.result | 34 +- mysql-test/main/explain.result | 120 +- mysql-test/main/explain.test | 2 +- mysql-test/main/explain_innodb.result | 6 +- mysql-test/main/explain_json.result | 62 +- .../main/explain_json_format_partitions.result | 4 +- mysql-test/main/explain_non_select.result | 166 +- mysql-test/main/explain_slowquerylog.result | 8 +- mysql-test/main/ext_key_noPK_6794.result | 1 + mysql-test/main/fetch_first.result | 34 +- mysql-test/main/fulltext.result | 72 +- mysql-test/main/fulltext_order_by.result | 4 +- mysql-test/main/func_analyse.result | 6 +- mysql-test/main/func_compress.result | 8 +- mysql-test/main/func_concat.result | 6 +- mysql-test/main/func_debug.result | 6 +- mysql-test/main/func_default.result | 4 +- mysql-test/main/func_gconcat.result | 4 +- mysql-test/main/func_group.result | 310 +-- mysql-test/main/func_group_innodb.result | 50 +- mysql-test/main/func_in.result | 220 +- mysql-test/main/func_json.result | 6 +- mysql-test/main/func_like.result | 8 +- mysql-test/main/func_str.result | 24 +- mysql-test/main/gis-rt-precise.result | 8 +- mysql-test/main/gis-rtree.result | 44 +- mysql-test/main/gis.result | 16 +- mysql-test/main/grant_explain_non_select.result | 36 +- mysql-test/main/greedy_optimizer.result | 672 +++--- mysql-test/main/group_by.result | 336 +-- mysql-test/main/group_by_innodb.result | 12 +- mysql-test/main/group_min_max.result | 1146 +++++------ mysql-test/main/group_min_max_innodb.result | 44 +- mysql-test/main/having.result | 16 +- mysql-test/main/having_cond_pushdown.result | 336 +-- 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_innodb.result | 94 +- mysql-test/main/index_merge_innodb.result | 106 +- mysql-test/main/index_merge_myisam.result | 572 +++--- mysql-test/main/information_schema.result | 78 +- mysql-test/main/innodb_bug878769.result | 6 +- mysql-test/main/innodb_ext_key,off.rdiff | 106 +- mysql-test/main/innodb_ext_key.result | 142 +- 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/insert_returning.result | 20 +- mysql-test/main/insert_select.result | 6 +- mysql-test/main/intersect.result | 20 +- mysql-test/main/intersect_all.result | 20 +- mysql-test/main/invisible_field.result | 14 +- mysql-test/main/invisible_field_debug.result | 12 +- mysql-test/main/join.result | 180 +- mysql-test/main/join_cache.result | 1274 ++++++------ mysql-test/main/join_nested.result | 94 +- mysql-test/main/join_nested_jcl6.result | 134 +- mysql-test/main/join_optimizer.result | 6 +- mysql-test/main/join_outer.result | 282 +-- mysql-test/main/join_outer_innodb.result | 132 +- mysql-test/main/join_outer_jcl6.result | 282 +-- 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 | 234 +-- mysql-test/main/long_unique.result | 6 +- 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/multi_update.result | 22 +- mysql-test/main/myisam.result | 166 +- .../main/myisam_explain_non_select_all.result | 394 ++-- mysql-test/main/myisam_icp.result | 114 +- mysql-test/main/myisam_icp_debug.result | 4 +- mysql-test/main/myisam_mrr.result | 68 +- mysql-test/main/myisam_optimize.result | 4 +- mysql-test/main/negation_elimination.result | 100 +- mysql-test/main/null.result | 28 +- mysql-test/main/null_key.result | 170 +- mysql-test/main/odbc.result | 4 +- mysql-test/main/olap.result | 4 +- mysql-test/main/opt_trace.result | 248 +-- mysql-test/main/opt_trace_index_merge.result | 12 +- .../main/opt_trace_index_merge_innodb.result | 4 +- mysql-test/main/opt_tvc.result | 16 +- mysql-test/main/order_by.result | 366 ++-- mysql-test/main/order_by_innodb.result | 36 +- mysql-test/main/order_by_optimizer.result | 10 +- mysql-test/main/order_by_optimizer_innodb.result | 16 +- mysql-test/main/order_by_optimizer_innodb.test | 2 + mysql-test/main/order_by_zerolength-4285.result | 4 +- mysql-test/main/partition.result | 104 +- mysql-test/main/partition_column.result | 28 +- mysql-test/main/partition_column_prune.result | 24 +- mysql-test/main/partition_datatype.result | 80 +- mysql-test/main/partition_default.result | 120 +- mysql-test/main/partition_disabled.result | 4 +- mysql-test/main/partition_explicit_prune.result | 40 +- mysql-test/main/partition_hash.result | 40 +- mysql-test/main/partition_list.result | 8 +- mysql-test/main/partition_mrr_aria.result | 4 +- mysql-test/main/partition_mrr_innodb.result | 4 +- mysql-test/main/partition_mrr_myisam.result | 16 +- mysql-test/main/partition_order.result | 4 +- mysql-test/main/partition_pruning.result | 2139 ++++++++++---------- mysql-test/main/partition_pruning.test | 6 +- mysql-test/main/partition_range.result | 108 +- mysql-test/main/pool_of_threads.result | 172 +- mysql-test/main/processlist_notembedded.result | 4 +- mysql-test/main/ps.result | 88 +- 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/range.result | 636 +++--- mysql-test/main/range_debug.result | 4 +- mysql-test/main/range_innodb.result | 22 +- mysql-test/main/range_innodb.test | 1 + mysql-test/main/range_mrr_icp.result | 636 +++--- mysql-test/main/range_notembedded.result | 20 +- mysql-test/main/range_vs_index_merge.result | 368 ++-- mysql-test/main/range_vs_index_merge_innodb.result | 368 ++-- mysql-test/main/row.result | 46 +- mysql-test/main/rowid_filter.result | 88 +- mysql-test/main/rowid_filter_innodb.result | 96 +- 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 | 8 +- mysql-test/main/select.result | 602 +++--- mysql-test/main/select_debug.result | 6 +- mysql-test/main/select_found.result | 6 +- mysql-test/main/select_jcl6.result | 602 +++--- mysql-test/main/select_pkeycache.result | 602 +++--- mysql-test/main/select_safe.result | 12 +- mysql-test/main/selectivity.result | 30 +- mysql-test/main/selectivity_no_engine.result | 12 +- mysql-test/main/set_operation.result | 36 +- mysql-test/main/show_analyze_partition.result | 4 +- mysql-test/main/show_explain.result | 518 ++--- 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/sp-row.result | 4 +- mysql-test/main/sp.result | 28 +- mysql-test/main/ssl.result | 172 +- mysql-test/main/ssl_compress.result | 172 +- mysql-test/main/stat_tables.result | 94 +- mysql-test/main/stat_tables_disabled.result | 24 +- mysql-test/main/stat_tables_innodb.result | 94 +- mysql-test/main/statistics.result | 8 +- mysql-test/main/statistics_json.result | 44 +- mysql-test/main/status.result | 12 +- mysql-test/main/subselect.result | 454 ++--- mysql-test/main/subselect2.result | 46 +- mysql-test/main/subselect3.result | 264 +-- mysql-test/main/subselect3_jcl6.result | 264 +-- mysql-test/main/subselect4.result | 1150 +++++------ mysql-test/main/subselect_cache.result | 18 +- mysql-test/main/subselect_exists2in.result | 24 +- mysql-test/main/subselect_exists2in_costmat.result | 6 +- mysql-test/main/subselect_extra.result | 100 +- mysql-test/main/subselect_extra_no_semijoin.result | 96 +- mysql-test/main/subselect_innodb.result | 66 +- mysql-test/main/subselect_mat.result | 324 +-- mysql-test/main/subselect_mat_cost.result | 132 +- mysql-test/main/subselect_mat_cost_bugs.result | 112 +- mysql-test/main/subselect_no_exists_to_in.result | 450 ++-- mysql-test/main/subselect_no_mat.result | 436 ++-- mysql-test/main/subselect_no_opts.result | 440 ++-- mysql-test/main/subselect_no_scache.result | 454 ++--- mysql-test/main/subselect_no_semijoin.result | 440 ++-- mysql-test/main/subselect_partial_match.result | 364 ++-- mysql-test/main/subselect_sj.result | 596 +++--- mysql-test/main/subselect_sj2.result | 218 +- mysql-test/main/subselect_sj2_jcl6.result | 258 +-- mysql-test/main/subselect_sj2_mat.result | 306 +-- mysql-test/main/subselect_sj_jcl6.result | 680 +++---- mysql-test/main/subselect_sj_mat.result | 226 +-- 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 | 236 +-- mysql-test/main/table_elim_debug.result | 18 +- mysql-test/main/table_value_constr.result | 164 +- 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_blob.result | 44 +- mysql-test/main/type_date.result | 52 +- mysql-test/main/type_datetime.result | 16 +- mysql-test/main/type_float.result | 20 +- mysql-test/main/type_int.result | 56 +- mysql-test/main/type_newdecimal.result | 16 +- mysql-test/main/type_time.result | 40 +- mysql-test/main/type_timestamp.result | 16 +- mysql-test/main/type_timestamp.test | 4 +- mysql-test/main/type_uint.result | 6 +- mysql-test/main/type_varchar.result | 184 +- mysql-test/main/udf.result | 4 +- mysql-test/main/union.result | 64 +- mysql-test/main/update.result | 4 +- mysql-test/main/update_use_source.result | 48 +- mysql-test/main/user_var.result | 24 +- mysql-test/main/variables.result | 12 +- mysql-test/main/view.result | 146 +- 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/suite/archive/rnd_pos.result | 16 +- mysql-test/suite/compat/oracle/r/sp-row.result | 4 +- .../compat/oracle/r/table_value_constr.result | 98 +- .../suite/encryption/r/tempfiles_encrypted.result | 88 +- .../federated/federatedx_create_handlers.result | 40 +- mysql-test/suite/federated/optimizer.result | 4 +- mysql-test/suite/funcs_1/r/innodb_views.result | 4 +- mysql-test/suite/funcs_1/r/memory_views.result | 4 +- mysql-test/suite/gcol/inc/gcol_keys.inc | 2 +- mysql-test/suite/gcol/inc/gcol_select.inc | 6 +- mysql-test/suite/gcol/r/gcol_bugfixes.result | 34 +- mysql-test/suite/gcol/r/gcol_ins_upd_innodb.result | 32 +- mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result | 32 +- mysql-test/suite/gcol/r/gcol_keys_innodb.result | 122 +- mysql-test/suite/gcol/r/gcol_keys_myisam.result | 122 +- mysql-test/suite/gcol/r/gcol_select_innodb.result | 204 +- mysql-test/suite/gcol/r/gcol_select_myisam.result | 266 +-- mysql-test/suite/gcol/r/gcol_view_innodb.result | 38 +- mysql-test/suite/gcol/r/gcol_view_myisam.result | 38 +- mysql-test/suite/gcol/r/innodb_virtual_fk.result | 28 +- mysql-test/suite/heap/heap.result | 98 +- mysql-test/suite/heap/heap_btree.result | 78 +- mysql-test/suite/heap/heap_hash.result | 168 +- mysql-test/suite/innodb/r/innodb-dict.result | 16 +- .../suite/innodb/r/innodb-index-online.result | 8 +- mysql-test/suite/innodb/r/innodb-index.result | 112 +- mysql-test/suite/innodb/r/innodb-index_ucs2.result | 16 +- mysql-test/suite/innodb/r/innodb-isolation.result | 70 +- .../suite/innodb/r/innodb-table-online.result | 4 +- mysql-test/suite/innodb/r/innodb.result | 140 +- mysql-test/suite/innodb/r/innodb_bug30423.result | 16 +- .../r/innodb_bulk_create_index_replication.result | 8 +- .../innodb/r/innodb_bulk_create_index_small.result | 16 +- mysql-test/suite/innodb/r/innodb_gis.result | 20 +- .../innodb/r/innodb_lock_wait_timeout_1.result | 8 + .../suite/innodb/r/innodb_stats_persistent.result | 40 +- mysql-test/suite/innodb/r/partition_locking.result | 8 +- mysql-test/suite/innodb/r/temporary_table.result | 16 +- .../innodb/r/temporary_table_optimization.result | 12 +- mysql-test/suite/innodb/t/innodb-table-online.test | 2 +- mysql-test/suite/innodb_fts/r/fulltext.result | 64 +- mysql-test/suite/innodb_fts/r/fulltext_misc.result | 40 +- .../suite/innodb_fts/r/fulltext_order_by.result | 4 +- mysql-test/suite/innodb_gis/r/0.result | 16 +- mysql-test/suite/innodb_gis/r/1.result | 16 +- mysql-test/suite/innodb_gis/r/bug17057168.result | 4 +- .../suite/innodb_gis/r/create_spatial_index.result | 780 +++---- mysql-test/suite/innodb_gis/r/geometry.result | 64 +- mysql-test/suite/innodb_gis/r/gis.result | 16 +- .../suite/innodb_gis/r/innodb_gis_rtree.result | 44 +- mysql-test/suite/innodb_gis/r/point_basic.result | 20 +- mysql-test/suite/innodb_gis/r/rt_precise.result | 4 +- mysql-test/suite/innodb_gis/r/rtree.result | 8 +- .../suite/innodb_gis/r/rtree_estimate.result | 64 +- .../suite/innodb_gis/r/rtree_multi_pk.result | 4 +- mysql-test/suite/innodb_gis/r/types.result | 4 +- .../suite/innodb_zip/r/index_large_prefix.result | 32 +- mysql-test/suite/innodb_zip/r/page_size,4k.rdiff | 4 +- mysql-test/suite/innodb_zip/r/page_size,8k.rdiff | 4 +- mysql-test/suite/innodb_zip/r/page_size.result | 4 +- mysql-test/suite/json/r/json_no_table.result | 4 +- mysql-test/suite/json/r/json_table.result | 48 +- mysql-test/suite/json/r/json_table_mysql.result | 132 +- mysql-test/suite/maria/collations.result | 8 +- mysql-test/suite/maria/create.result | 6 +- mysql-test/suite/maria/icp.result | 84 +- .../suite/maria/maria-gis-rtree-dynamic.result | 8 +- .../suite/maria/maria-gis-rtree-trans.result | 8 +- mysql-test/suite/maria/maria-gis-rtree.result | 8 +- mysql-test/suite/maria/maria.result | 174 +- mysql-test/suite/maria/mrr.result | 30 +- mysql-test/suite/maria/ps_maria.result | 5 +- mysql-test/suite/parts/r/optimizer.result | 8 +- .../suite/parts/r/partition_alter3_innodb.result | 112 +- .../suite/parts/r/partition_alter3_myisam.result | 112 +- mysql-test/suite/perfschema/r/digest_view.result | 40 +- mysql-test/suite/perfschema/r/misc.result | 4 +- mysql-test/suite/plugins/r/audit_null.result | 4 +- mysql-test/suite/sql_sequence/next.result | 8 +- .../suite/sys_vars/r/max_seeks_for_key_func.result | 36 +- mysql-test/suite/vcol/r/vcol_keys_myisam.result | 4 +- mysql-test/suite/vcol/r/vcol_misc.result | 6 +- mysql-test/suite/vcol/r/vcol_select_innodb.result | 128 +- mysql-test/suite/vcol/r/vcol_select_myisam.result | 144 +- mysql-test/suite/vcol/r/vcol_view_innodb.result | 24 +- mysql-test/suite/vcol/r/vcol_view_myisam.result | 24 +- mysql-test/suite/versioning/r/partition.result | 20 +- mysql-test/suite/versioning/t/partition.test | 4 +- .../mysql-test/type_inet/type_inet6.result | 12 +- .../mysql-test/type_inet/type_inet6_innodb.result | 32 +- .../mysql-test/type_inet/type_inet6_memory.result | 32 +- .../mysql-test/type_inet/type_inet6_myisam.result | 40 +- .../mysql-test/type_test/type_test_double.result | 4 +- .../mysql-test/type_test/type_test_int8.result | 4 +- .../mysql-test/type_uuid/type_uuid.result | 12 +- .../mysql-test/type_uuid/type_uuid_innodb.result | 82 +- .../mysql-test/type_uuid/type_uuid_memory.result | 76 +- .../mysql-test/type_uuid/type_uuid_myisam.result | 76 +- sql/sql_class.cc | 13 +- sql/sql_explain.cc | 22 +- sql/sql_select.cc | 9 +- sql/sql_show.cc | 1 + storage/connect/mysql-test/connect/r/alter.result | 4 +- storage/connect/mysql-test/connect/r/bson.result | 4 +- storage/connect/mysql-test/connect/r/json.result | 4 +- .../mysql-test/connect/r/mysql_index.result | 4 +- .../connect/mysql-test/connect/r/part_file.result | 28 +- .../connect/mysql-test/connect/r/part_table.result | 8 +- .../mroonga/storage/r/geometry_contains.result | 4 +- ...riable_max_n_records_for_estimate_global.result | 4 +- ..._records_for_estimate_not_found_in_limit.result | 4 +- ...iable_max_n_records_for_estimate_session.result | 4 +- .../mroonga/wrapper/r/count_star_with_index.result | 8 +- .../sequence/mysql-test/sequence/group_by.result | 54 +- storage/sequence/mysql-test/sequence/simple.result | 42 +- 378 files changed, 19879 insertions(+), 19857 deletions(-) diff --git a/mysql-test/include/index_merge_ror_cpk.inc b/mysql-test/include/index_merge_ror_cpk.inc index 97f636df19f..c2da93cf383 100644 --- a/mysql-test/include/index_merge_ror_cpk.inc +++ b/mysql-test/include/index_merge_ror_cpk.inc @@ -65,6 +65,7 @@ explain select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; select * from t1 where pk1 = 1 and pk2 < 80 and key1=0; # Verify that CPK fields are considered to be covered by index scans +--replace_column 11 FLTRD explain select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; @@ -78,7 +79,9 @@ explain select * from t1 where pk1 < 7500 and key1 = 10; set optimizer_switch=@tmp_index_merge_ror_cpk; # Verify that keys with 'tails' of PK members are ok. +--replace_column 11 FLTRD explain select * from t1 where pktail1ok=1 and key1=10; +--replace_column 11 FLTRD explain select * from t1 where pktail2ok=1 and key1=10; # Note: The following is actually a deficiency, it uses sort_union currently. @@ -86,12 +89,16 @@ explain select * from t1 where pktail2ok=1 and key1=10; explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10; # The expected rows differs a bit from platform to platform +--replace_column 11 FLTRD --replace_result 98 ROWS 99 ROWS explain select * from t1 where pktail3bad=1 and key1=10; +--replace_column 11 FLTRD explain select * from t1 where pktail4bad=1 and key1=10; +--replace_column 11 FLTRD explain select * from t1 where pktail5bad=1 and key1=10; # Test for problem with innodb key values prefetch buffer: +--replace_column 11 FLTRD explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; diff --git a/mysql-test/main/analyze_stmt.result b/mysql-test/main/analyze_stmt.result index 5d6ae89efcd..02ca4768dd0 100644 --- a/mysql-test/main/analyze_stmt.result +++ b/mysql-test/main/analyze_stmt.result @@ -90,27 +90,27 @@ 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 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) +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 ALL NULL NULL NULL NULL 10 100.00 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 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 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) +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 ALL NULL NULL NULL NULL 10 100.00 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 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 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) +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 ALL NULL NULL NULL NULL 10 100.00 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 partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra @@ -328,8 +328,8 @@ select * from t1; i insert into t1 values (1),(2); explain delete from t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 2 NULL 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 cfa1725c27c..892608a753e 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10000 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 10000 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 5 NULL 9 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 5 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10000 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 10000 100.00 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 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 +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; Using temporary; Using filesort +1 SIMPLE t2 NULL ref a a 5 test.t0.a 1 100.00 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 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 +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; Using filesort +1 SIMPLE t2 NULL ref a a 5 test.t0.a 1 100.00 explain format=json select * from t0,t2 where t2.a=t0.a order by t0.a limit 4; EXPLAIN @@ -418,8 +418,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 1 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 1 NULL Deleting all rows # ANALYZE shows that delete_all_rows() didn't work and we deleted rows # one-by-one: analyze @@ -625,8 +625,8 @@ 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx 5 NULL 7 100.00 Using index for group-by analyze select col1 f1, col2 f2, col1 f3 from t2 group by f1; id select_type table partitions type possible_keys key key_len ref rows r_rows filtered r_filtered Extra diff --git a/mysql-test/main/analyze_stmt_privileges2.result b/mysql-test/main/analyze_stmt_privileges2.result index 0d3d51f0cb2..9eb2e709dcf 100644 --- a/mysql-test/main/analyze_stmt_privileges2.result +++ b/mysql-test/main/analyze_stmt_privileges2.result @@ -355,8 +355,8 @@ a b 10 NULL 10 NULL EXPLAIN SELECT * FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 ANALYZE SELECT * FROM t1; 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 @@ -367,18 +367,18 @@ a b 10 NULL 10 NULL EXPLAIN SELECT * FROM t1 WHERE a = 10; -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 +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 ANALYZE SELECT * FROM t1 WHERE a = 10; 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 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 +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 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -390,83 +390,83 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); EXPLAIN INSERT INTO v1 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO v1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where ANALYZE UPDATE v1 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where ANALYZE UPDATE v1 SET a = a + 1; 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 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 +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 20 100.00 Using where ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 ANALYZE DELETE FROM v1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 ANALYZE DELETE FROM v1 WHERE a = 10; 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 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 +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 8 100.00 Using where ANALYZE DELETE FROM v1 USING v1, t2; 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 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 +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 8 100.00 Using where ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; 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 @@ -474,26 +474,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; -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 +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 ANALYZE SELECT * FROM v1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 ANALYZE SELECT * FROM v1 WHERE a = 10; 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 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 +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 +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 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -505,66 +505,66 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 100.00 Using where ANALYZE UPDATE v2 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 100.00 Using where ANALYZE UPDATE v2 SET a = a + 1; 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 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 +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 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 100.00 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where ANALYZE DELETE FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where ANALYZE DELETE FROM v2 WHERE a = 10; 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 @@ -581,26 +581,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where ANALYZE SELECT * FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; 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 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 +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 +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 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -621,15 +621,15 @@ connection con1; #------------------------------------------------------------------------ INSERT INTO t1 (a) VALUES (10); EXPLAIN INSERT INTO t1 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO t1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO t1 SELECT * FROM t2; 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 @@ -904,8 +904,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 100.00 ANALYZE UPDATE t1 SET a = 10; 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 @@ -1181,8 +1181,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 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 0 NULL Deleting all rows ANALYZE DELETE FROM t1; 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 @@ -1437,30 +1437,30 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 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 0 NULL Deleting all rows ANALYZE DELETE FROM t1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where ANALYZE DELETE FROM t1 WHERE a = 10; 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 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 +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 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 ANALYZE DELETE FROM t1 USING t1, t2; 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 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 +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 ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; 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 @@ -1490,83 +1490,83 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE INSERT INTO v1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where +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 ANALYZE UPDATE v1 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where +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 ANALYZE UPDATE v1 SET a = a + 1; 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 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 +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 16 100.00 Using where ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 ANALYZE DELETE FROM v1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 ANALYZE DELETE FROM v1 WHERE a = 10; 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 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 +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 4 100.00 Using where ANALYZE DELETE FROM v1 USING v1, t2; 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 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 +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 4 100.00 Using where ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; 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 @@ -1574,26 +1574,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; -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 +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 ANALYZE SELECT * FROM v1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 ANALYZE SELECT * FROM v1 WHERE a = 10; 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 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 +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 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 3 100.00 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -1607,83 +1607,83 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where ANALYZE UPDATE v2 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where ANALYZE UPDATE v2 SET a = a + 1; 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 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 +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 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 ANALYZE DELETE FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 ANALYZE DELETE FROM v2 WHERE a = 10; 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 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 +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 8 100.00 Using where ANALYZE DELETE FROM v2 USING v2, t2; 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 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 +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 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where ANALYZE DELETE FROM v2 USING v2, t2 WHERE v2.a = t2.a; 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 @@ -1691,26 +1691,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -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 +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 ANALYZE SELECT * FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 ANALYZE SELECT * FROM v2 WHERE a = 10; 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 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 +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 +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 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -1731,105 +1731,105 @@ connection con1; #------------------------------------------------------------------------ INSERT INTO t1 (a) VALUES (10); EXPLAIN INSERT INTO t1 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO t1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO t1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO t1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO t1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 100.00 ANALYZE UPDATE t1 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24 100.00 ANALYZE UPDATE t1 SET a = a + 1; 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 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 +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 24 100.00 Using where ANALYZE UPDATE t1, t2 SET t1.a = t1.a + 1 WHERE t1.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 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 0 NULL Deleting all rows ANALYZE DELETE FROM t1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where ANALYZE DELETE FROM t1 WHERE a = 10; 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 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 +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 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 ANALYZE DELETE FROM t1 USING t1, t2; 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 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 +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 ANALYZE DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 ANALYZE SELECT * FROM t1; 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 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 +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 ANALYZE SELECT * FROM t1 WHERE a = 10; 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 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 +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 ANALYZE SELECT * FROM t1 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -1839,83 +1839,83 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); EXPLAIN INSERT INTO v1 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO v1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where +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 ANALYZE UPDATE v1 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 16 Using where +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 ANALYZE UPDATE v1 SET a = a + 1; 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 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 +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 16 100.00 Using where ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 ANALYZE DELETE FROM v1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 ANALYZE DELETE FROM v1 WHERE a = 10; 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 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 +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 4 100.00 Using where ANALYZE DELETE FROM v1 USING v1, t2; 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 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 +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 4 100.00 Using where ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; 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 @@ -1923,26 +1923,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; -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 +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 ANALYZE SELECT * FROM v1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 ANALYZE SELECT * FROM v1 WHERE a = 10; 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 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 +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 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 3 100.00 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -1955,66 +1955,66 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE INSERT INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where ANALYZE UPDATE v2 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where ANALYZE UPDATE v2 SET a = a + 1; 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 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 +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 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 ANALYZE DELETE FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 ANALYZE DELETE FROM v2 WHERE a = 10; 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 @@ -2031,26 +2031,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -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 +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 ANALYZE SELECT * FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 ANALYZE SELECT * FROM v2 WHERE a = 10; 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 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 +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 +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 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -2680,26 +2680,26 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 Using where +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 ANALYZE SELECT * FROM v1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 14 Using where +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 ANALYZE SELECT * FROM v1 WHERE a = 10; 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 14 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 3 100.00 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -2711,66 +2711,66 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 100.00 Using where ANALYZE UPDATE v2 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 100.00 Using where ANALYZE UPDATE v2 SET a = a + 1; 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 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 +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 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 30 100.00 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where ANALYZE DELETE FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where ANALYZE DELETE FROM v2 WHERE a = 10; 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 @@ -2787,26 +2787,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where ANALYZE SELECT * FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 18 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 3 100.00 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -3751,8 +3751,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 29 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 29 100.00 Using where ANALYZE DELETE FROM v1; 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 @@ -3886,83 +3886,83 @@ connection con1; #------------------------------------------------------------------------ INSERT INTO v1 (a) VALUES (10); EXPLAIN INSERT INTO v1 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO v1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v1 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v1 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 100.00 Using where ANALYZE UPDATE v1 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 47 100.00 Using where ANALYZE UPDATE v1 SET a = a + 1; 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 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 +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 47 100.00 Using where ANALYZE UPDATE v1, t2 SET v1.a = v1.a + 1 WHERE v1.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 100.00 Using where ANALYZE DELETE FROM v1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 100.00 Using where ANALYZE DELETE FROM v1 WHERE a = 10; 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 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 +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 35 100.00 Using where ANALYZE DELETE FROM v1 USING v1, t2; 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 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 +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 35 100.00 Using where ANALYZE DELETE FROM v1 USING v1, t2 WHERE v1.a = t2.a; 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 @@ -3970,26 +3970,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v1; a b EXPLAIN SELECT * FROM v1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 100.00 Using where ANALYZE SELECT * FROM v1; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 35 100.00 Using where ANALYZE SELECT * FROM v1 WHERE a = 10; 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 35 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 3 100.00 ANALYZE SELECT * FROM v1 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -4001,66 +4001,66 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 100.00 Using where ANALYZE UPDATE v2 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 100.00 Using where ANALYZE UPDATE v2 SET a = a + 1; 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 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 +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 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 51 100.00 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 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 39 100.00 Using where ANALYZE DELETE FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 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 39 100.00 Using where ANALYZE DELETE FROM v2 WHERE a = 10; 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 @@ -4077,26 +4077,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 39 100.00 Using where ANALYZE SELECT * FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 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 39 100.00 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 39 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 3 100.00 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -4385,8 +4385,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 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 39 100.00 Using where ANALYZE SELECT a FROM v2; 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 @@ -4405,8 +4405,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 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 39 100.00 Using where ANALYZE SELECT a FROM v2 WHERE a = 10; 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 @@ -4597,26 +4597,26 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 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 39 100.00 Using where ANALYZE SELECT * FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 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 39 100.00 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 39 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 3 100.00 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); 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 @@ -4859,15 +4859,15 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 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 43 100.00 Using where ANALYZE UPDATE v2 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 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 43 100.00 Using where ANALYZE UPDATE v2 SET a = a + 1; 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 @@ -5128,66 +5128,66 @@ connection con1; #------------------------------------------------------------------------ INSERT INTO v2 (a) VALUES (10); EXPLAIN INSERT INTO v2 (a) VALUES (10); -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 +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 ANALYZE INSERT INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE INSERT INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 ANALYZE REPLACE INTO v2 (a) VALUES (10); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 ANALYZE REPLACE INTO v2 SELECT * FROM t2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 100.00 Using where ANALYZE UPDATE v2 SET a = 10; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 100.00 Using where ANALYZE UPDATE v2 SET a = a + 1; 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 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 +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 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 56 100.00 Using where ANALYZE UPDATE v2, t2 SET v2.a = v2.a + 1 WHERE v2.a = t2.a; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 100.00 Using where ANALYZE DELETE FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 100.00 Using where ANALYZE DELETE FROM v2 WHERE a = 10; 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 @@ -5204,26 +5204,26 @@ id select_type table partitions type possible_keys key key_len ref rows r_rows f SELECT * FROM v2; a b EXPLAIN SELECT * FROM v2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 100.00 Using where ANALYZE SELECT * FROM v2; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 44 100.00 Using where ANALYZE SELECT * FROM v2 WHERE a = 10; 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 44 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 3 100.00 ANALYZE SELECT * FROM v2 WHERE a IN ( SELECT a FROM t2 ); 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 diff --git a/mysql-test/main/aria_icp_debug.result b/mysql-test/main/aria_icp_debug.result index be1a29ae408..0fdfe63aa37 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range kp1 kp1 5 NULL 10 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range kp1 kp1 5 NULL 10 100.00 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/binary.result b/mysql-test/main/binary.result index b6fe5a06968..1c29c21a43f 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL idx 20 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 20 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx idx 20 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx idx 20 const 1 100.00 Using where; Using index SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908'); hex(a) DROP TABLE t1; diff --git a/mysql-test/main/column_compression_parts.result b/mysql-test/main/column_compression_parts.result index bc3028826ee..75ebda88f0f 100644 --- a/mysql-test/main/column_compression_parts.result +++ b/mysql-test/main/column_compression_parts.result @@ -54,11 +54,11 @@ SELECT i,SUBSTRING(a,1,10) FROM t1 where (a between 'h' and 'z') and (i=9) ORDER i SUBSTRING(a,1,10) 9 M EXPLAIN PARTITIONS SELECT i,SUBSTRING(a,1,10) FROM t1 where (a>'m'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3,p4 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p3,p4 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT i,SUBSTRING(a,1,10) FROM t1 where (a<'w'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 7 100.00 Using where ALTER TABLE t1 TRUNCATE PARTITION p2; ALTER TABLE t1 DROP PARTITION p0; SHOW CREATE TABLE t1; diff --git a/mysql-test/main/compare.result b/mysql-test/main/compare.result index ec197977214..c920774e277 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index PRIMARY PRIMARY 12 NULL 2 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 12 NULL 2 100.00 Using where; Using index select * from t1 where id=000000000001; id 000000000001 @@ -114,9 +114,9 @@ select * from t1 where a>="aaa"; a bb explain select * from t1 where a="aaa"; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 3 const 1 100.00 Using where; Using index explain select * from t1 where a="aa "; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 3 const 1 100.00 Using where; Using index drop table t1; diff --git a/mysql-test/main/compress.result b/mysql-test/main/compress.result index 47bbeadd011..53ebbf529f2 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 100.00 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 100.00 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 100.00 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -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 +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 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 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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 100.00 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 @@ -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 partitions type possible_keys key key_len ref rows 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 explain select fld3 from t2 where fld1=fld1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 +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 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 partitions type possible_keys key key_len ref rows 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 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 2dbe79249bc..97a9610ccc9 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref B B 21 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref B B 21 const 1 100.00 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 118f898e57a..387083bd944 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 Using where +1 PRIMARY <derived2> NULL ref key0 key0 8 test.t2.c 2 100.00 Using where; FirstMatch(t2) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 Using where +1 PRIMARY <derived3> NULL ref key0 key0 8 test.t2.c 2 100.00 Using where; FirstMatch(t2) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 r1.a 1 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 r1.a 1 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 +3 UNION t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +NULL UNION RESULT <union1,3> NULL ALL NULL 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 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 +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 +3 UNION t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +NULL UNION RESULT <union1,3> NULL ALL NULL 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 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 +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 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 1 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +3 UNION t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 1 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +3 UNION t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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) +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 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 Using where +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +4 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +4 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 Using where +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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; Using temporary; Using filesort +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 35 func 1 100.00 +4 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +4 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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; Using temporary; Using filesort +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 35 func 1 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL system NULL NULL NULL NULL 1 100.00 +3 DERIVED NULL 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 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) +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 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) DROP TABLE t1,t2,t3; # # MDEV-10729: Server crashes in st_select_lex::set_explain_type @@ -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 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 +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 t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +4 UNION <derived3> NULL ALL NULL NULL NULL NULL 9 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union1,4> NULL ALL NULL NULL NULL NULL NULL NULL DROP TABLE t1,t2; # # MDEV-13780: tower of embedding CTEs with multiple usage of them diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index 7aea6355990..e1275797c24 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 30 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 5 100.00 +3 UNION t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +3 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 +3 RECURSIVE UNION t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL # just WITH : types of t1 columns are determined by all parts of union create view v1 as with @@ -1234,14 +1234,14 @@ from folks as p, ancestors as ma where p.id = ma.mother ) select * from ancestors; -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 +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 PRIMARY NULL NULL NULL 12 100.00 +3 RECURSIVE UNION <derived2> NULL ref key0 key0 5 test.p.id 2 100.00 +4 RECURSIVE UNION p NULL ALL PRIMARY NULL NULL NULL 12 100.00 +4 RECURSIVE UNION <derived2> NULL ref key0 key0 5 test.p.id 2 100.00 +NULL UNION RESULT <union2,3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 24 100.00 +4 DERIVED folks NULL ALL NULL NULL NULL NULL 12 100.00 Using where +6 UNION <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 +5 RECURSIVE UNION <derived4> NULL ALL NULL NULL NULL NULL 24 100.00 +NULL UNION RESULT <union4,6,5> NULL ALL NULL NULL NULL NULL NULL NULL +3 DERIVED folks NULL ALL NULL NULL NULL NULL 12 100.00 Using where +2 RECURSIVE UNION folks NULL ALL PRIMARY NULL NULL NULL 12 100.00 +2 RECURSIVE UNION <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union3,2> NULL ALL NULL 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 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 +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 t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +4 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 +4 RECURSIVE UNION t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +NULL UNION RESULT <union2,4> NULL ALL NULL NULL NULL NULL NULL NULL drop table t1,t2; # # MDEV-11278: non-mergeable view in the spec of recursive CTE @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 15 100.00 Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 15 100.00 Using where +3 RECURSIVE UNION t2 NULL ALL NULL NULL NULL NULL 15 100.00 Using where +3 RECURSIVE UNION <derived2> NULL ref key0 key0 5 test.t2.id 2 100.00 +4 RECURSIVE UNION t2 NULL ALL NULL NULL NULL NULL 15 100.00 Using where +4 RECURSIVE UNION <derived2> NULL ref key0 key0 5 test.t2.id 2 100.00 +NULL UNION RESULT <union2,3,4> NULL ALL NULL NULL NULL NULL NULL NULL DROP TABLE t1,t2; set tmp_memory_table_size=default; # @@ -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 partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 23 test.t1.a1 1 100.00 FirstMatch(t1) +3 DERIVED t2 NULL const PRIMARY PRIMARY 22 const 1 100.00 Using index +4 RECURSIVE UNION <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +4 RECURSIVE UNION tt2 NULL ref b1 b1 23 cte.a2 2 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL 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' @@ -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 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 +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 DERIVED s NULL ALL NULL NULL NULL NULL 4 100.00 +3 RECURSIVE UNION t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +3 RECURSIVE UNION <derived2> NULL ref key0 key0 9 test.t1.c 2 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL +4 UNION <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 PRIMARY tt NULL ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY tt NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 3 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 1728 100.00 +4 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 1728 100.00 +5 RECURSIVE UNION <derived3> NULL ALL NULL NULL NULL NULL 1728 100.00 +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL NULL +3 DERIVED v NULL ALL NULL NULL NULL NULL 12 100.00 Using where +3 DERIVED h NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +3 DERIVED w NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (incremental, BNL join) +2 RECURSIVE UNION <derived4> NULL ALL NULL NULL NULL NULL 2 100.00 +2 RECURSIVE UNION h NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +2 RECURSIVE UNION w NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (incremental, BNL join) +NULL UNION RESULT <union3,2> NULL ALL NULL 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 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) +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 +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 +5 RECURSIVE UNION <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union3,4,5> NULL ALL NULL NULL NULL NULL NULL NULL +2 DERIVED h NULL ALL NULL NULL NULL NULL 12 100.00 +2 DERIVED w NULL ALL NULL NULL NULL NULL 12 100.00 Using join buffer (flat, BNL join) +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 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 ee84659367e..a3c0c21988c 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 100.00 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data diff --git a/mysql-test/main/ctype_collate.result b/mysql-test/main/ctype_collate.result index 6b4acff6a52..2de9bc6ff3f 100644 --- a/mysql-test/main/ctype_collate.result +++ b/mysql-test/main/ctype_collate.result @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref s1 s1 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref s1 s1 11 const 1 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref s2 s2 11 const 1 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref s1 s1 11 const 1 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 2 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 2 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 1 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 34 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 4 100.00 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_cp1251.result b/mysql-test/main/ctype_cp1251.result index 0ae805265e1..6b8cb0a5cc9 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 100.00 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 365b24bd57c..b963d266cf5 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 100.00 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result index 09b2cb69924..10a88f89d88 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 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 +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 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 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 +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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 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 +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 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 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 +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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range c c 43 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c c 43 NULL 3 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 97 NULL 96 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 67 NULL 96 100.00 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 f65bce6453a..2ce6a7fe936 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 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 +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 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 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 +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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 e8f03f440a7..b0679683992 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 23 NULL 2 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 23 NULL 2 100.00 Using where; Using index explain select * from t1 where a like concat('abc','%'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 23 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 130 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 130 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 130 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 130 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 20 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 20 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 23 NULL 1 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 23 NULL 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a LIKE 'c%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 23 NULL 31 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 23 NULL 1 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 23 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 23 NULL 31 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 23 NULL 31 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 23 NULL 1 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 23 NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 100.00 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data diff --git a/mysql-test/main/ctype_utf16.result b/mysql-test/main/ctype_utf16.result index e3a5dfb2225..c7224db8371 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 43 NULL 2 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 43 NULL 2 100.00 Using where; Using index explain select * from t1 where a like concat('abc','%'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 43 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 40 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 40 NULL 3 100.00 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 f1dfea3d5b4..0a4d687d904 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range c c 43 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c c 43 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 cdc75a11385..e3e98e3c452 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 43 NULL 2 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 43 NULL 2 100.00 Using where; Using index explain select * from t1 where a like concat('abc','%'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 43 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 40 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 40 NULL 3 100.00 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 ae0c77a82df..91e8998fa43 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 43 NULL 2 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 43 NULL 2 100.00 Using where; Using index explain select * from t1 where a like concat('abc','%'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 43 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 258 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 40 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 40 NULL 3 100.00 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 0e9c8cc65c7..8b923ac4e34 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range c c 43 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c c 43 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 ecf78cbed11..f941883bfae 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 40 NULL 4 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 40 NULL 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 40 const 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 14 NULL 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 14 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary +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 temporary select distinct a from t1; a e explain select a from t1 group by a; -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 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range date_column date_column 6 NULL 2 100.00 Using index condition DROP TABLE t1; # # Bug #31384 DATE_ADD() and DATE_SUB() return binary data @@ -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 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 +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 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 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 +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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 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 +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 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 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 +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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index ch ch 183 NULL # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ch ch 183 NULL # 100.00 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 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 +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 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 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 +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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL ch NULL NULL NULL # Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL ch NULL NULL NULL # 100.00 Using where; Using filesort SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 33 NULL 1 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 33 NULL 1 100.00 Using index condition PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a between ? and _utf8'¢'"; EXECUTE stmt USING @arg; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 33 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 13 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 13 const 1 100.00 Using index condition PREPARE stmt FROM "EXPLAIN SELECT * FROM t1 WHERE a between ? and _utf8'¢'"; EXECUTE stmt USING @arg; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 13 const 1 100.00 Using index condition DEALLOCATE PREPARE stmt; DROP TABLE t1; # diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result index 5224406ac5c..90fafd1809a 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 53 NULL 4 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 53 NULL 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 53 const 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 14 NULL 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 14 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary +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 temporary select distinct a from t1; a e explain select a from t1 group by a; -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 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 100.00 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 c13c69c3e45..df37fe68aae 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 12 100.00 Using where EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 53 const 4 100.00 Using where EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 12 100.00 Using where EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 14 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 100.00 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 3a7f4c11beb..b62e10b5c48 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 53 NULL 4 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 53 NULL 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 53 const 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 14 NULL 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 14 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 100.00 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 ba4c2c53dd7..e8e6bb6eb76 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 53 NULL 4 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 53 NULL 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a = 'Käli Käli 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 53 const 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a LIKE 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 14 NULL 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t2 WHERE a = 'Kali Kali 2+4'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 14 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using temporary +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Y NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort +1 SIMPLE Z NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE crashtest NULL ALL NULL NULL NULL NULL 4 100.00 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 abeba159010..54dcc6ae7d0 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a_id 127 NULL 96 100.00 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 51bf39a0b12..f5d72c6099c 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 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 +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 <derived2> NULL ref key0 key0 5 test.t1.sal 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 show status like "%custom_aggregate%"; Variable_name Value Feature_custom_aggregate_functions 6 diff --git a/mysql-test/main/delete.result b/mysql-test/main/delete.result index dd03009ae93..baf85463724 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 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 +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.a 1 100.00 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 8 test.t2.b,test.t1.b 1 100.00 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 5ea61364228..eaebda3430f 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL index NULL PRIMARY 255 NULL 3 100.00 Using index +1 SIMPLE b NULL ALL NULL NULL NULL NULL 3 100.00 DELETE b FROM t1 AS a JOIN t1 AS b; SELECT * FROM t1; c1 diff --git a/mysql-test/main/derived.result b/mysql-test/main/derived.result index 51fdd66ac55..b00c1a88eb9 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY x1 NULL ALL NULL NULL NULL NULL 4 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 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 8 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 4 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL explain select * from (select * from t1 union all select * from t1) a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 8 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 system NULL NULL NULL NULL 1 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY tt1 NULL index NULL a 4 NULL 10000 100.00 Using index +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 10000 100.00 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 10000 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 9 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 100.00 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 9 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 100.00 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 100.00 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 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 +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 +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 THEMAX.E2 1 100.00 Using where +2 DERIVED A NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +5 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL NULL +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 289 100.00 Using temporary; Using filesort +2 DERIVED x NULL ALL NULL NULL NULL NULL 17 100.00 Using temporary; Using filesort +2 DERIVED y NULL ALL NULL NULL NULL NULL 17 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index explain select a from (select a from t2 where a>1) tt; -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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 <derived3> NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +4 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY <derived5> NULL ALL NULL NULL NULL NULL 2 100.00 +5 DERIVED t2 NULL index NULL b 5 NULL 2 100.00 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 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 +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 <derived3> NULL ref key0 key0 5 const 0 0.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using temporary Warnings: Note 1249 Select 4 was reduced during optimization DROP TABLE t1, t2; @@ -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 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 +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 +1 PRIMARY <derived3> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived4> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived5> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived6> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived7> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived8> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived9> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived10> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived11> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived12> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived13> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived14> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived15> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived16> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived17> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived18> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived19> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived20> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived21> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived22> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived23> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived24> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived25> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived26> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived27> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived28> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY <derived29> NULL system NULL NULL NULL NULL 0 0.00 Const row not found +29 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +28 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +27 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +26 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +25 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +24 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +23 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +22 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +21 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +20 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +19 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +18 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +17 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +16 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +15 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +14 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +13 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +12 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +11 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +10 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +9 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +8 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +7 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +6 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +2 DERIVED NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 1002 100.00 +1 PRIMARY <derived3> NULL hash_ALL NULL #hash#$hj 3075 func 1002 100.00 Using where; Using join buffer (flat, BNLH join) +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 v3.d 1 100.00 Using index +3 DERIVED t3 NULL ALL NULL NULL NULL NULL 1002 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 1002 100.00 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 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 +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 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 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 +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 hash_ALL NULL #hash#$hj 3 test.t2.c1 5 100.00 Using where; Using join buffer (flat, BNLH join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 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 diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index c7b12e2da8a..ccc029fc189 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t.a 2 100.00 Using where +2 DERIVED t1_double NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 3 test.t.a 2 100.00 Using where +2 DERIVED t1_decimal NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.d 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 10 test.t2.a,test.t2.a 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +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 Using where +1 PRIMARY t NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1_char NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 6 test.t.b,test.t.b 2 100.00 +2 DERIVED t1_decimal NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 10 test.t2.a,test.t2.c 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.d 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 18 test.t.c,test.t.c 2 100.00 Using where +2 DERIVED t1_double NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 9 test.t.c 2 100.00 Using where +2 DERIVED t1_double NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +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 Using where +1 PRIMARY t NULL ALL NULL NULL NULL NULL 9 100.00 Using join buffer (flat, BNL join) +2 DERIVED t1_decimal NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 10 test.t2.a,test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 10 test.t2.a,test.t2.b 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key1 key1 5 test.t2.a 2 100.00 +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ref key0 key0 5 v1.b 2 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key1 key1 10 test.t2.a,test.t2.a 2 100.00 +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ref key0 key0 5 v1.b 2 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +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 Using where +1 PRIMARY t NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1_char NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key1 key1 5 test.t2.b 2 100.00 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 v1.a 2 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived3> NULL ref key0 key0 5 v1.a 2 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v1.b 2 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t2.b 2 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 UNION t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +2 UNION <derived4> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 UNION t2 NULL ALL NULL NULL NULL NULL 9 100.00 +2 UNION <derived4> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using temporary; Using filesort +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 UNION t2 NULL ALL NULL NULL NULL NULL 9 100.00 +2 UNION <derived4> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using temporary; Using filesort +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 UNION t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +2 UNION <derived5> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +5 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 UNION t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +3 UNION <derived6> NULL ref key0 key0 5 test.t2.c 2 100.00 Using where +6 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +NULL UNION RESULT <union1,2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 40 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 40 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 40 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 12 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 2 test.t.a 2 100.00 Using where +2 DERIVED t1_char NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 40 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 6 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +4 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 4 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key1 key1 5 test.t2.a 2 100.00 +1 PRIMARY <derived4> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key1 key1 5 test.t2.a 2 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.a 2 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.a 2 100.00 +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.a 2 100.00 +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.a 2 100.00 +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 PRIMARY <derived4> NULL ref key0 key0 5 v4.min_c 2 100.00 +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.c 2 100.00 Using where +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 20 100.00 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); @@ -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 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 +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; FirstMatch(t1) +3 DEPENDENT SUBQUERY <derived5> NULL index_subquery key0 key0 5 func 2 100.00 Using where +5 DERIVED t4 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 2 100.00 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 +1 PRIMARY <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 2 100.00 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 144 100.00 Using where +2 DERIVED <derived4> NULL ALL NULL NULL NULL NULL 12 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 12 100.00 EXPLAIN FORMAT=JSON INSERT INTO t1 SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; EXPLAIN @@ -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 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 +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 ref a a 5 const 1 100.00 +3 UNION t1 NULL ref a a 5 const 1 100.00 # 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 UNION <derived4> NULL ALL NULL NULL NULL NULL 18 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +5 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect4,5> NULL ALL NULL NULL NULL NULL NULL NULL +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +4 UNION t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 UNION t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +4 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +4 UNION t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +4 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT <derived4> NULL ALL NULL NULL NULL NULL 18 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +5 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect4,5> NULL ALL NULL NULL NULL NULL NULL NULL +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT <derived4> NULL ALL NULL NULL NULL NULL 18 100.00 Using where +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +5 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect4,5> NULL ALL NULL NULL NULL NULL NULL NULL +6 UNION t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,6> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +4 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED <derived3> NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +4 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL INTERSECT RESULT <intersect2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 EXCEPT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL EXCEPT RESULT <except2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 3 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +3 INTERSECT t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +4 UNION t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using temporary; Using filesort +NULL UNIT RESULT <unit2,3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 100.00 Using where +2 DERIVED t3 NULL range i1 i1 5 NULL 5 100.00 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 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 +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 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t3 NULL range i1 i1 5 NULL 2 100.00 Using index condition +3 UNION t3 NULL range i1 i1 5 NULL 1 100.00 Using index condition +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 9 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.b 2 100.00 Using where +2 DERIVED t3 NULL range i1 i1 5 NULL 1 100.00 Using index condition +3 UNION t3 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using temporary; Using filesort +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 80.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 32 100.00 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 80.00 Using where; Using temporary +3 UNION t2 NULL ALL idx NULL NULL NULL 20 80.00 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 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 +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 +1 PRIMARY <derived2> NULL ref key0 key0 24 test.t1.a,test.t1.c 2 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 48 100.00 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 80.00 Using where; Using temporary +3 UNION t2 NULL ALL idx NULL NULL NULL 20 80.00 Using where; Using temporary +4 UNION t2 NULL ALL idx NULL NULL NULL 20 80.00 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 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 +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 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 80.00 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 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 +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 Using where +2 DERIVED t2 NULL ALL idx NULL NULL NULL 20 80.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 20 100.00 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 @@ -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 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 +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 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort drop table t1; # # MDEV-16104: embedded splittable materialized derived/views @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY u NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 5 test.u.id 2 100.00 +2 DERIVED au NULL ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort select * from t1 as u left join (select * from t2 as au group by au.userid) as auditlastlogin @@ -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 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 +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 Using where +1 PRIMARY t1 NULL ref a a 5 test.t3.id 1 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.id 2 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED cp2 NULL range NULL a 5 NULL 8 100.00 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 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 +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 Using where +1 PRIMARY t1 NULL ref a a 5 test.t3.id 1 100.00 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.id 2 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 +2 LATERAL DERIVED cp2 NULL ref a a 5 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL range t1_id t1_id 5 NULL 47 100.00 Using where; Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.t1_id 1 100.00 Using index +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.t1_id 2 100.00 +2 LATERAL DERIVED t2 NULL ref t1_id t1_id 5 test.t1.id 3 59.09 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY charges NULL ALL PRIMARY,fk_charge_from_ledger,fk_charge_to_ledger NULL NULL NULL 20 40.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 17 test.charges.from_ledger_id,test.charges.id 2 100.00 +2 LATERAL DERIVED transaction_items NULL ref fk_items_transaction,fk_items_charge fk_items_charge 9 test.charges.id 2 100.00 +2 LATERAL DERIVED transactions NULL eq_ref PRIMARY,fk_transactions_ledger PRIMARY 8 test.transaction_items.transaction_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY charges NULL ALL PRIMARY,fk_charge_from_ledger,fk_charge_to_ledger NULL NULL NULL 20 40.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 17 test.charges.from_ledger_id,test.charges.id 4 100.00 +2 DERIVED transaction_items NULL ALL fk_items_transaction NULL NULL NULL 40 100.00 Using temporary; Using filesort +2 DERIVED transactions NULL eq_ref PRIMARY PRIMARY 8 test.transaction_items.transaction_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY charges NULL ALL fk_charge_to_ledger NULL NULL NULL 20 50.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 18 test.charges.from_ledger_id,test.charges.id 2 100.00 +2 LATERAL DERIVED transaction_items NULL ref fk_items_transaction,fk_items_charge fk_items_charge 9 test.charges.id 2 100.00 +2 LATERAL DERIVED transactions NULL eq_ref PRIMARY,fk_transactions_ledger PRIMARY 8 test.transaction_items.transaction_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY charges NULL ALL fk_charge_to_ledger NULL NULL NULL 20 50.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 18 test.charges.from_ledger_id,test.charges.id 4 100.00 +2 DERIVED transaction_items NULL ALL fk_items_transaction NULL NULL NULL 40 100.00 Using temporary; Using filesort +2 DERIVED transactions NULL eq_ref PRIMARY PRIMARY 8 test.transaction_items.transaction_id 1 100.00 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 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 +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 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 51ee1c6867c..851ef703c26 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE x1 NULL ALL NULL NULL NULL NULL 4 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 4 100.00 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 partitions type possible_keys key key_len ref rows 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 7 test.m2.matintnum 2 100.00 +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 100.00 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 7 test.m2.matintnum 2 100.00 +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 100.00 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.A.E2 1 100.00 Using where +3 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +4 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +5 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union4,5> NULL ALL NULL NULL NULL NULL NULL NULL +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index explain select a from (select a from t2 where a>1) tt; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 +5 SUBQUERY NULL 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 NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL 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 NULL Impossible WHERE noticed after reading const tables execute stmt1 ; -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 +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 +5 SUBQUERY NULL 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 NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL 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 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 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 +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 +5 SUBQUERY NULL 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 NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL 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 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 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 +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 t1 NULL ref a a 5 const 1 100.00 Using index +2 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 <derived2> NULL ref key0 key0 5 const 1 100.00 Using where; Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 # 100.00 +1 PRIMARY tx NULL eq_ref PRIMARY PRIMARY 4 tu.pk # 100.00 Using index +1 PRIMARY ty NULL eq_ref PRIMARY PRIMARY 4 tu.pk # 100.00 Using index +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL # 100.00 +3 DERIVED td NULL system PRIMARY NULL NULL NULL # 100.00 Using temporary +3 DERIVED tc NULL ref PRIMARY,a a 3 const # 100.00 +3 DERIVED ta NULL eq_ref PRIMARY PRIMARY 4 test.tc.pk # 100.00 Using index +3 DERIVED tb NULL eq_ref PRIMARY PRIMARY 4 test.tc.pk # 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab1_v27 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 SIMPLE tab1_v26 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v27.f1,test1.tab1_v27.f2 5 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE tab1_v25 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v22 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v19 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v16 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v13 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v10 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v7 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v4 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v1 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 100.00 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 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab1_v27 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 SIMPLE tab1_v26 NULL hash_ALL NULL #hash#$hj 62 test1.tab1_v27.f1,test1.tab1_v27.f2 5 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE tab1_v25 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v26.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v22 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v23.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v19 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v20.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v16 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v17.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v13 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v14.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v10 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v11.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v7 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v8.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v4 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v5.f1 5 100.00 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 100.00 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 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE tab1_v1 NULL hash_ALL NULL #hash#$hj 31 test1.tab1_v2.f1 5 100.00 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.a 10 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 100 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.id 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 8 100.00 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_split_innodb.result b/mysql-test/main/derived_split_innodb.result index 810ff43f878..c48b97e3762 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref c1,n1_c1_n2 c1 1 const 2 100.00 Using index condition; Using where; Using temporary; Using filesort +1 PRIMARY <derived2> NULL ref key0 key0 8 test.t1.n1,test.t1.n2 2 100.00 +2 LATERAL DERIVED t1 NULL ref c1,n1_c1_n2 n1_c1_n2 4 test.t1.n1 1 0.20 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.id2 2 100.00 +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using temporary; Using filesort +2 DERIVED t1 NULL eq_ref PRIMARY,id2 PRIMARY 4 test.t3.i3 1 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.id 2 100.00 +2 LATERAL DERIVED t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL const f2 NULL NULL NULL 1 100.00 Impossible ON condition +1 PRIMARY <derived2> NULL const key1 NULL NULL NULL 1 100.00 Impossible ON condition +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 DERIVED t2 NULL ALL PRIMARY NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL const f2 NULL NULL NULL 1 100.00 Impossible ON condition +1 PRIMARY <derived3> NULL const key1 NULL NULL NULL 1 100.00 Impossible ON condition +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 +3 DERIVED t2 NULL index NULL PRIMARY 4 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index a,a_2 a_2 10 NULL 6 100.00 Using where; Using index +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1.a 2 100.00 +3 DERIVED t1 NULL index NULL a_2 10 NULL 6 100.00 Using where; Using index +3 DERIVED t2 NULL ref c c 5 test.t1.b 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index a,a_2 a_2 10 NULL 6 100.00 Using where; Using index +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1.a 2 100.00 +3 LATERAL DERIVED t1 NULL ref a,a_2 a 5 test.t1.a 1 100.00 Using where; Using temporary; Using filesort +3 LATERAL DERIVED t2 NULL ref c c 5 test.t1.b 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 +1 PRIMARY <derived2> NULL ref key1 key1 4 test.t2.id 2 100.00 +1 PRIMARY t1 NULL ALL idx NULL NULL NULL 6 83.33 Using where; Using join buffer (flat, BNL join) +2 DERIVED t3 NULL ref idx1,idx2 idx1 4 const 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 +1 PRIMARY <derived2> NULL ref key1 key1 4 test.t2.id 2 100.00 +1 PRIMARY t1 NULL ALL idx NULL NULL NULL 6 83.33 Using where; Using join buffer (flat, BNL join) +2 DERIVED t3 NULL ref idx1 idx1 4 const 5 100.00 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 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 +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 # ... 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 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 +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 4 100.00 +2 DERIVED t4 NULL ALL NULL NULL NULL NULL 40 100.00 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 e7562a4f575..0f9d005b703 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 11 +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 select * from (select * from t1) tt; f1 f11 1 1 @@ -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 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 +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 show status like 'Handler_read%'; Variable_name Value Handler_read_first 0 @@ -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 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 +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 show status like 'Handler_read%'; Variable_name Value Handler_read_first 0 @@ -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 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 +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 +1 PRIMARY xx NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index f1 f1 5 NULL 3 100.00 Using where; Using index +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.f1 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 SELECT MIN(a) FROM v1 WHERE a >= 5; MIN(a) 5 EXPLAIN SELECT MIN(a) FROM v1 WHERE a >= 5; -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 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 DROP VIEW v1; DROP TABLE t1; # @@ -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 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 +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 ref a a 4 const 1 100.00 Using index +1 PRIMARY <derived2> NULL ref key0 key0 8 const,const 1 100.00 +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 12 100.00 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 @@ -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 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 +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; Using filesort +1 PRIMARY t4 NULL ref f2 f2 4 t.f1 1 100.00 Using index +1 PRIMARY t3 NULL ref f2 f2 4 t.f1 2 100.00 Using index +2 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 Using temporary +2 DERIVED t1 NULL ref f2 f2 4 const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t.a 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 t3 NULL system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 t3 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 temporary +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 temporary +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 100.00 DROP VIEW v1; DROP TABLE t1,t2,t3; # @@ -1463,32 +1463,32 @@ b 29 EXPLAIN SELECT DISTINCT t2.b FROM t1,t2,t3 WHERE t3.a = t2.a; -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 +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 Using temporary +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL ref a a 35 test.t3.a 2 100.00 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 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 +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 system NULL NULL NULL NULL 1 100.00 Using temporary +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t2 NULL ref a a 35 test.t3.a 2 100.00 SELECT * FROM v1; b 28 29 EXPLAIN SELECT * FROM v1; -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 +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 system NULL NULL NULL NULL 1 100.00 Using temporary +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t2 NULL ref a a 35 test.t3.a 2 100.00 DROP VIEW v1; DROP TABLE t1,t2,t3; # @@ -1580,10 +1580,10 @@ a 2 EXPLAIN SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1); -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 +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 <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 2 100.00 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 1 100.00 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 100.00 +4 UNION t3 NULL ALL NULL NULL NULL NULL 4 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL NULL NULL NULL NULL NULL DROP VIEW v1,v2; DROP TABLE t1,t2,t3; # @@ -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 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 +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 +2 DERIVED <derived3> NULL system NULL NULL NULL NULL 1 100.00 +3 DERIVED NULL 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 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) +id select_type 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 3 100.00 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 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) +id select_type 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 3 100.00 Using where; Using join buffer (flat, BNL join) SELECT * FROM v1 WHERE b IS NULL; a b 1 NULL @@ -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 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 +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) +2 DEPENDENT SUBQUERY t NULL unique_subquery PRIMARY,c PRIMARY 4 func 1 100.00 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 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 +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) +2 DEPENDENT SUBQUERY t3 NULL unique_subquery PRIMARY,c PRIMARY 4 func 1 100.00 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; End temporary +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 <derived3> NULL ref key1 key1 8 const,const 0 0.00 Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary; Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 <derived3> NULL ref key0 key0 10 test.t1.b,test.t1.a 2 100.00 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 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 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 +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 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 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 +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 Using where; Using filesort +1 PRIMARY <derived3> NULL ref key0 key0 4 v1.b 2 100.00 +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary; Using filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 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 (flat, BNL join) +1 SIMPLE t3 NULL ref e e 3 test.t2.d 1 100.00 Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 5 100.00 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 @@ -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 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 +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 <derived2> NULL ALL NULL NULL NULL NULL 1 100.00 Using where +2 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 1 100.00 Using where +3 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 21 100.00 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 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 +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 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY COLUMNS NULL ALL NULL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED STATISTICS NULL ALL NULL 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 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 +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 <derived2> NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 <derived2> NULL ref key0 key0 5 const 0 0.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using filesort SELECT * FROM t1, v WHERE a = b; a b gc 132 132 test1,text3 @@ -2771,11 +2771,11 @@ LEFT JOIN pictures p ON p.id = g.p_random ORDER BY gallery_name ASC ; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary; Using filesort +1 PRIMARY p NULL eq_ref PRIMARY PRIMARY 4 g.p_random 1 100.00 Using where +2 DERIVED gal NULL ALL NULL NULL NULL NULL 10 100.00 +3 DEPENDENT SUBQUERY pi NULL ref gallery_id gallery_id 4 test.gal.id 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY x NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +2 DERIVED t1 NULL index NULL index_td_familyid_id 772 NULL 2 100.00 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 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 +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 <derived2> NULL ALL NULL NULL NULL NULL 11 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY m2 NULL ALL NULL NULL NULL NULL 9 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 7 test.m2.matintnum 2 100.00 +2 DERIVED mp NULL ALL NULL NULL NULL NULL 9 100.00 Using temporary; Using filesort +2 DERIVED m1 NULL eq_ref PRIMARY PRIMARY 3 test.mp.mat_id 1 100.00 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 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) +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 +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 139 100.00 Using index; FirstMatch(t1) explain select * from (select a from t1 where a in (select b from t2)) t; -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) +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 +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 139 100.00 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 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) +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 +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 139 100.00 Using index; FirstMatch(t1) drop view v1; drop table t1,t2; # @@ -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 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) +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 t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p1 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p3 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p1 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p3 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p1 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p3 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived17> NULL ALL NULL NULL NULL NULL 50328437500000 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived14> NULL ALL NULL NULL NULL NULL 27680640625000000 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived9> NULL ALL NULL NULL NULL NULL 15224352343750000640 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived10> NULL ALL NULL NULL NULL NULL 15224352343750000640 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived11> NULL ALL NULL NULL NULL NULL 15224352343750000640 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived12> NULL ALL NULL NULL NULL NULL 15224352343750000640 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived13> NULL ALL NULL NULL NULL NULL 15224352343750000640 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived15> NULL ALL NULL NULL NULL NULL 15224352343750000640 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived16> NULL ALL NULL NULL NULL NULL 15224352343750000640 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived7> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived8> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +17 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +17 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +17 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +16 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +16 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +16 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +15 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +15 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +15 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +14 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +14 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +14 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +13 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +13 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +13 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +12 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +12 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +12 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +11 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +11 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +11 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +10 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +10 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +10 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +9 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +9 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +9 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +8 DERIVED p1 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +8 DERIVED p3 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +8 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED t2 NULL system NULL NULL NULL NULL 1 100.00 +7 DERIVED p1 NULL ALL NULL NULL NULL NULL 550 100.00 Using where +7 DERIVED p3 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (flat, BNL join) +7 DERIVED p4 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p5 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p6 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p7 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p8 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p9 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p10 NULL ALL NULL NULL NULL NULL 550 100.00 Using where; Using join buffer (incremental, BNL join) DROP TABLE t1, t2; # # MDEV-19778: equality condition for mergeable view returning constants diff --git a/mysql-test/main/desc_index_range.result b/mysql-test/main/desc_index_range.result index 9d45513b37a..34d53b3631c 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 3 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 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range ab ab 4 NULL 51 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range ab ab 4 NULL 51 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range ab ab 8 NULL 46 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range ab ab 8 NULL 46 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range ab ab 8 NULL 17 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range ab ab 8 NULL 17 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range ab ab 4 NULL 40 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range ab ab 4 NULL 40 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range ab ab 8 NULL 31 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range ab ab 8 NULL 31 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref PRIMARY PRIMARY 4 const 1000 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 4 const 1000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b b,a 5,5 NULL 1 FLTRD 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/desc_index_range.test b/mysql-test/main/desc_index_range.test index db59922e177..1a51fb875c2 100644 --- a/mysql-test/main/desc_index_range.test +++ b/mysql-test/main/desc_index_range.test @@ -119,6 +119,7 @@ insert into t1 values (10000, NULL, 255); insert into t1 select seq+20000, seq+20000, seq+20000 from seq_1_to_1500; --echo # Must use ROR-intersect: +--replace_column 11 FLTRD explain select * from t1 where b = 255 AND a IS NULL; select * from t1 where b = 255 AND a IS NULL; diff --git a/mysql-test/main/distinct.result b/mysql-test/main/distinct.result index 6bb31d13b4d..1cbab064f50 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index a a 4 NULL 5 100.00 Using index; Using temporary +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where +1 SIMPLE t3 NULL ref a a 5 test.t1.b 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using temporary +1 SIMPLE t3 NULL ref a a 5 test.t1.a 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 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 4 100.00 Using index explain SELECT distinct t1.a from t1 order by a desc; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index explain SELECT t1.a from t1 group by a order by a desc; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index explain SELECT distinct t1.a from t1 order by a desc limit 1; -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 +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 index explain SELECT distinct a from t3 order by a desc limit 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index NULL a 5 NULL 40 25.00 Using index explain SELECT distinct a,b from t3 order by a+1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 204 100.00 Using temporary; Using filesort explain SELECT distinct a,b from t3 order by a limit 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index NULL a 5 NULL 2 100.00 Using temporary explain SELECT a,b from t3 group by a,b order by a+1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 204 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index id id 4 NULL 2 100.00 Using index; Using temporary +1 SIMPLE t2 NULL index id id 8 NULL 1 100.00 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL index id id 8 NULL 1 100.00 Using index; Using join buffer (flat, BNL join) +1 SIMPLE j_lj_t2 NULL index id id 4 NULL 2 100.00 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 100.00 Using where; Using index +1 SIMPLE j_lj_t3 NULL index id id 4 NULL 2 100.00 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 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 3 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 3 100.00 Using index EXPLAIN SELECT DISTINCT a,b FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 EXPLAIN SELECT DISTINCT t1_1.a, t1_1.b FROM t1 t1_1, t1 t1_2; -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1_1 NULL ALL NULL NULL NULL NULL 3 100.00 Using temporary +1 SIMPLE t1_2 NULL index NULL PRIMARY 4 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1_1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using temporary +1 SIMPLE t1_2 NULL eq_ref PRIMARY PRIMARY 4 test.t1_1.a 1 100.00 Using index; Distinct EXPLAIN SELECT a FROM t1 GROUP BY a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 3 100.00 Using index EXPLAIN SELECT a,b FROM t1 GROUP BY a,b; -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 +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 EXPLAIN SELECT DISTINCT a,b FROM t1 GROUP BY a,b; -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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL PRIMARY 4 NULL 4 100.00 Using index for group-by EXPLAIN SELECT DISTINCT a,a FROM t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL PRIMARY 4 NULL 4 100.00 Using index for group-by EXPLAIN SELECT DISTINCT b,a FROM t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL PRIMARY 8 NULL 3 100.00 Using index EXPLAIN SELECT DISTINCT a,c FROM t2; -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 +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 Using temporary EXPLAIN SELECT DISTINCT c,a,b FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d; -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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 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 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 16 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 8 NULL 16 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN SELECT (SELECT DISTINCT ADDDATE(a,1) FROM t1 WHERE ADDDATE(a,1) = '2002-08-03'); -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 +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 ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 6 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 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 6 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 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL PRIMARY 16 NULL 7 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where; Using temporary +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 # double = int explain select distinct a from t1 where a = 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 +id select_type 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 # string = double alter table t1 modify a varchar(100); explain select distinct a from t1 where a = 2e0; -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 +id select_type 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 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'); @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index; Using temporary +2 UNCACHEABLE UNION t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index; Using temporary +NULL UNION RESULT <union1,2> NULL ALL NULL 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit +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 Zero limit explain select * from t1 limit 0 offset 10; -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 +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 Zero limit drop table t1, t2; diff --git a/mysql-test/main/endspace.result b/mysql-test/main/endspace.result index 7eada7a411a..dcce5ff0047 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL key1 34 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL key1 34 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref key1 key1 22 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1 key1 22 const 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL key1 34 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL key1 34 NULL 3 100.00 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 1889c83039b..8ba7c383da1 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 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 +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 +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 be9948f7fbc..21c0284cd7d 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 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 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 f8e709c03f8..8bb7122ee24 100644 --- a/mysql-test/main/except.result +++ b/mysql-test/main/except.result @@ -7,10 +7,10 @@ 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 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 +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 EXPLAIN extended (select a,b from t1) except (select c,d from t2); 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 @@ -241,19 +241,19 @@ 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 EXCEPT t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +NULL EXCEPT RESULT <except1,2> NULL ALL NULL 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 EXCEPT t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +NULL EXCEPT RESULT <except1,2> NULL ALL NULL 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 partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 4 100.00 diff --git a/mysql-test/main/except_all.result b/mysql-test/main/except_all.result index 6360097cdb8..5cc6f5bd71f 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 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 +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 EXPLAIN format=json select * from t1 except all select * from t2; EXPLAIN { @@ -352,20 +352,20 @@ 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 EXCEPT t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 EXCEPT t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +NULL EXCEPT RESULT <except1,2> NULL ALL NULL 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 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 +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 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 partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 9 100.00 diff --git a/mysql-test/main/explain.result b/mysql-test/main/explain.result index b451d08373c..29169a6d15d 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar"); select * from t1 where str is null; id str @@ -12,51 +12,51 @@ select * from t1 where str="foo"; id str 3 foo explain select * from t1 where str is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref str str 11 const 2 100.00 Using index condition explain select * from t1 where str="foo"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const str str 11 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const str str 11 const 1 100.00 explain select * from t1 ignore key (str) where str="foo"; -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 +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 explain select * from t1 use key (str,str) where str="foo"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const str str 11 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const str str 11 const 1 100.00 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 partitions type possible_keys key key_len ref rows 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 create table t1 (a int not null); explain select count(*) from t1; -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 +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 insert into t1 values(1); explain select count(*) from t1; -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 +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 insert into t1 values(1); explain select count(*) from t1; -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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE ��� NULL ref ���0,���01 ���0 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ��� NULL ref ���0,���01 ���0 5 const 1 100.00 Using index drop table ���; set names latin1; select 3 into @v1; explain select 3 into @v1; -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 +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 create table t1(f1 int, f2 int); insert into t1 values (1,1); create view v1 as select * from t1 where f1=1; @@ -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 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) +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 +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); @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY INNR NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY INNR NULL ALL NULL NULL NULL NULL 2 100.00 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 @@ -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 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 +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 NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c2,c2_2 c2 10 const,const 4 100.00 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 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 +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 a NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 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 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 +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 a NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 Using where EXECUTE stmt; -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 +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 a NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 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 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 +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 a NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 Using where EXECUTE stmt; -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 +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 a NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 Using where DEALLOCATE PREPARE stmt; DROP TABLE t1; End of 5.1 tests. @@ -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 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 +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 system NULL NULL NULL NULL 1 100.00 drop table t1, t2; # End of 10.1 tests diff --git a/mysql-test/main/explain.test b/mysql-test/main/explain.test index bff5438d40d..c23bfb8fe63 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 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 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 14d3172af61..b39af997a66 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 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 +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 DERIVED t1 NULL range NULL id 53 NULL 2 100.00 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 4fbf7d546e4..cbf3af325ea 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 101 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY NULL NULL NULL 1 100.00 Impossible ON condition +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type 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 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 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 +id select_type 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 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 SIMPLE t4 NULL ref a a 5 test.t3.a 1 100.00 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_json_format_partitions.result b/mysql-test/main/explain_json_format_partitions.result index f164006d756..4d1a6aaff81 100644 --- a/mysql-test/main/explain_json_format_partitions.result +++ b/mysql-test/main/explain_json_format_partitions.result @@ -5,8 +5,8 @@ a int not null ) partition by key(a); insert into t1 select a from t2; explain partitions select * from t1 where a in (2,3,4); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 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 10 100.00 Using where explain format=json select * from t1 where a in (2,3,4); EXPLAIN { diff --git a/mysql-test/main/explain_non_select.result b/mysql-test/main/explain_non_select.result index 50388d1f29c..b5cdb621e56 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 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 8 100.00 Using where explain delete from t0 where a=3; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 100.00 Using where # DELETE without WHERE is a special case: explain delete from t0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 8 NULL 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 2 100.00 # This should use range, possible_keys={a,b} explain delete from t1 where a<20 and b < 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 1 100.00 Using where # This should use ALL + filesort explain delete from t1 order by a+1 limit 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 100.00 Using filesort # This should use range + using filesort explain delete from t1 where a<20 order by b limit 2; -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 +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; Using filesort # Try some subqueries: explain delete from t1 where a < (select max(a) from t0); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range a a 5 NULL 1 100.00 Using where +2 SUBQUERY t0 NULL ALL NULL NULL NULL NULL 8 100.00 explain delete from t1 where a < (select max(a) from t0 where a < t1.b); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 512 100.00 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 8 100.00 Using where # # Tests for multi-table DELETE # explain delete t1 from t0, t1 where t0.a = t1.a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 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 8 100.00 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 partitions type possible_keys key key_len ref rows 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 explain update t1 set a=a+1 where a=3 and a=4; -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 +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 # 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 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 512 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a,b a 5 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 1 100.00 Using where # This should use ALL + filesort explain update t1 set filler='fooo' order by a+1 limit 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 1 Using where; Using filesort +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; Using filesort # Try some subqueries: explain update t1 set filler='fooo' where a < (select max(a) from t0); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range a a 5 NULL 1 100.00 Using where +2 SUBQUERY t0 NULL ALL NULL NULL NULL NULL 8 100.00 explain update t1 set filler='fooo' where a < (select max(a) from t0 where a < t1.b); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 512 100.00 Using where +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 4 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 Using where explain delete from t0 returning a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 4 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 100.00 explain replace into t1 select * from t0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 100.00 drop table t0, t1; # # MDEV-5067: Valgrind warnings (Invalid read) in QPF_table_access::print_explain @@ -144,16 +144,16 @@ DROP TABLE t1; # create table t1 (i int); explain partitions update t1 set i = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 0 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 0 100.00 create table t2 (a int, b int) partition by hash(a) partitions 5; insert into t2 values (0,0),(1,1),(2,2),(3,3),(4,4); explain partitions update t2 set b=3 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 +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 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 +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 update t2 set b=3 where a in (3,4); 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 @@ -172,31 +172,31 @@ partition p2 values less than (30) ); insert into t1 values (9,9), (19,19), (29,29); explain partitions select * from t1 where a in (32,33); -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 +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 explain partitions delete from t1 where a in (32,33); -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 rows after partition pruning +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 matching rows after partition pruning explain partitions update t1 set b=12345 where a in (32,33); -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 rows after partition pruning +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 matching rows after partition pruning drop table t1; # # Tests for EXPLAIN INSERT ... VALUES # create table t1 (a int, key(a)); explain insert into t1 values (1),(2),(3); -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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 INSERT t2 NULL ALL NULL NULL NULL NULL NULL 100.00 NULL +3 SUBQUERY t1 NULL index NULL a 5 NULL 3 100.00 Using index +2 SUBQUERY NULL 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 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 +id select_type 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 global_priv NULL index NULL PRIMARY 1149 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +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 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 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 +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 UNION t3 NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 +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 drop table t1,t2; diff --git a/mysql-test/main/explain_slowquerylog.result b/mysql-test/main/explain_slowquerylog.result index 557a7fa49c7..e48901aae0d 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 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 10 100.00 Using where # # MDEV-5045: Server crashes in QPF_query::print_explain with log_slow_verbosity='query_plan,explain' # @@ -27,8 +27,8 @@ SELECT 1; # MDEV-5060 Server crashes on EXPLAIN EXTENDED or EXPLAIN PARTITIONS with explain in slow_log # EXPLAIN PARTITIONS SELECT 1 ; -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 +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 # # MDEV-5106: Server crashes in Explain_union::print_explain on ER_TOO_BIG_SELECT with explain in slow log # diff --git a/mysql-test/main/ext_key_noPK_6794.result b/mysql-test/main/ext_key_noPK_6794.result index 6ba6f57f672..4b657d14d00 100644 --- a/mysql-test/main/ext_key_noPK_6794.result +++ b/mysql-test/main/ext_key_noPK_6794.result @@ -17,5 +17,6 @@ key c2 key_len 5 ref const rows 1 +filtered 100.00 Extra Using where; Using index drop table t1; diff --git a/mysql-test/main/fetch_first.result b/mysql-test/main/fetch_first.result index f1de2578050..7af872243e0 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 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 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL t1_name 206 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL t1_name 206 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL t1_name 206 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL t1_name 206 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range t1_name t1_name 103 NULL 3 100.00 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 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 +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 filesort +2 DERIVED t1 NULL range t1_name t1_name 103 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 10 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 10 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using temporary +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 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 cf2a27f71b2..2e505f6ac71 100644 --- a/mysql-test/main/fulltext.result +++ b/mysql-test/main/fulltext.result @@ -51,35 +51,35 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL fulltext a a 0 1 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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0; -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 +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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1; -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 +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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0; -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 +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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1; -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 +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 explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections"); -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 +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 explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections"); -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 +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 explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections"); -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 +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 explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections"); -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 +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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%'; -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 +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 select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE); a b MySQL has now support for full-text search @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL fulltext b,a a 0 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL fulltext b,a a 0 1 31.25 Using where EXPLAIN SELECT * FROM t1 USE INDEX(a) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -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 +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 EXPLAIN SELECT * FROM t1 FORCE INDEX(a) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -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 +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 EXPLAIN SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b b 5 const 5 100.00 Using where EXPLAIN SELECT * FROM t1 USE INDEX(b) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b b 5 const 5 100.00 Using where EXPLAIN SELECT * FROM t1 FORCE INDEX(b) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b b 5 const 5 100.00 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 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 +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 fulltext b2 b2 0 1 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where # should return 0 SELECT count(*) FROM t1 WHERE not exists( diff --git a/mysql-test/main/fulltext_order_by.result b/mysql-test/main/fulltext_order_by.result index 1131eb54042..5dc7b767d99 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL fulltext message message 0 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL fulltext message message 0 1 100.00 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 ca346f65758..b9cc20b1318 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 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 +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 #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 ff832e3d6ec..b51b28fc2d1 100644 --- a/mysql-test/main/func_compress.result +++ b/mysql-test/main/func_compress.result @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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: 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 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 16677d0a736..746539adc0d 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL PRIMARY 102 NULL 3 100.00 Using index +1 SIMPLE t1 NULL eq_ref PRIMARY,a PRIMARY 318 func,const,const 1 100.00 Using where DROP TABLE t1, t2; # # Bug #50096: CONCAT_WS inside procedure returning wrong data diff --git a/mysql-test/main/func_debug.result b/mysql-test/main/func_debug.result index 602ce86458d..82985291cfc 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 8222944df28..6b5b6d0c7e3 100644 --- a/mysql-test/main/func_default.result +++ b/mysql-test/main/func_default.result @@ -13,8 +13,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 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_gconcat.result b/mysql-test/main/func_gconcat.result index 798481d9062..d8bb052100e 100644 --- a/mysql-test/main/func_gconcat.result +++ b/mysql-test/main/func_gconcat.result @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 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 select a, group_concat(b) from t1 group by a with rollup; a group_concat(b) 1 3,4,2,1,2 diff --git a/mysql-test/main/func_group.result b/mysql-test/main/func_group.result index c176e9959f2..f0618c19435 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 partitions type possible_keys key key_len ref rows 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 explain select max(t1.a1), max(t2.a2) from t1, t2; -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 +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 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; @@ -379,282 +379,282 @@ LAK Los Angeles CA TWU AAA AAA AA AME explain select min(a1) from t1; -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 +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 select min(a1) from t1; min(a1) AME explain select max(a4) from t1; -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 +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 select max(a4) from t1; max(a4) 0.1 explain select min(a5), max(a5) from t1; -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 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 select min(a1) from t1 where a1 > 'KKK'; min(a1) PLS explain select min(a1) from t1 where a1 >= 'KKK'; -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 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 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 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 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index PRIMARY PRIMARY 3 NULL 15 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 3 NULL 15 100.00 Using where; Using index explain select min(a1) from t1 where (a1 < 'KKK' or a1 > 'KKK'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 3 NULL 14 100.00 Using where; Using index explain select max(a3) from t1 where a2 < 2 and a3 < 'SEA'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range k1 k1 3 NULL 7 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range k1 k1 7 NULL 1 100.00 Using where; Using index +1 SIMPLE t2 NULL range k1 k1 3 NULL 2 100.00 Using where; Using index; Using join buffer (flat, BNL join) explain select min(a4 - 0.01) from t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k2 12 NULL 15 100.00 Using index explain select max(a4 + 0.01) from t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k2 12 NULL 15 100.00 Using index explain select min(a3) from t1 where (a2 +1 ) is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 7 NULL 15 100.00 Using where; Using index explain select min(a3) from t1 where (a2 + 1) = 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 7 NULL 15 100.00 Using where; Using index explain select min(a3) from t1 where 2 = (a2 + 1); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 7 NULL 15 100.00 Using where; Using index explain select min(a2) from t1 where a2 < 2 * a2 - 8; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 7 NULL 15 100.00 Using where; Using index explain select min(a1) from t1 where a1 between a3 and 'KKK'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 15 100.00 Using where explain select min(a4) from t1 where (a4 + 0.01) between 0.07 and 0.08; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k2 12 NULL 15 100.00 Using where; Using index explain select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME'; -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range k2 k2 4 NULL 6 100.00 Using where; Using index +1 SIMPLE t1 NULL index NULL PRIMARY 3 NULL 15 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref a a 5 const 3 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 5 const 3 100.00 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 SELECT MIN(a), MIN(b) FROM t5 WHERE a = 1; MIN(a) MIN(b) 1 1 @@ -1519,8 +1519,8 @@ EXPLAIN SELECT MAX(pk) as max, i FROM t1 ORDER BY max; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 # Only 11 is correct for collumn i in this result SELECT MAX(pk) as max, i @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 SELECT MAX(f1) FROM t1 WHERE f1 = 'abc'; MAX(f1) NULL EXPLAIN SELECT MAX(f2) FROM t1 WHERE f2 = 'abc'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref f2 f2 4 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 SELECT MIN(f1) FROM t1 WHERE f1 >= 'abc'; MIN(f1) b EXPLAIN SELECT MIN(f2) FROM t1 WHERE f2 >= 'abc'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range f2 f2 4 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range f2 f2 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range f2 f2 4 NULL 1 100.00 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 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 +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: 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 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 +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 matching min/max row +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 # # 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 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 +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 t2 NULL ALL NULL NULL NULL NULL 2 100.00 # # 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 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 +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 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED NULL 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 DROP TABLE t1; # # MDEV-6743 crash in GROUP_CONCAT(IF () ORDER BY 1) @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 93d69a88ece..0157b791367 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1i NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1i NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1m NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t1i NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1m NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE t2i NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2m NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1i NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL b 263 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 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_in.result b/mysql-test/main/func_in.result index 1184eef4a6c..f5ce27c4673 100644 --- a/mysql-test/main/func_in.result +++ b/mysql-test/main/func_in.result @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 5 NULL 11 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 5 NULL 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 5 NULL 912 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 5 NULL 912 100.00 Using index condition explain select * from t2 force index(a) where a <> 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 5 NULL 912 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 6 NULL 11 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 6 NULL 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 13 NULL 6 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 13 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 7 NULL 6 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 7 NULL 6 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.a 1 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t3.a 1 100.00 +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.a 1 100.00 +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t3.a 1 100.00 +2 DEPENDENT SUBQUERY t4 NULL index NULL PRIMARY 4 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index t1f1_idx t1f1_idx 2 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range t1f1_idx t1f1_idx 2 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index t1f1_idx t1f1_idx 2 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index t2f2 t2f2 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index t2f2 t2f2 5 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range t2f2 t2f2 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range t2f2 t2f2 5 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index t2f2 t2f2 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index t2f2 t2f2 5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_int c_int 4 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, 1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_int c_int 4 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_int c_int 4 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_int IN (1, NULL, 2, NULL, 3, NULL); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_int c_int 4 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_int IN (NULL, NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_decimal c_decimal 3 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, 1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_decimal c_decimal 3 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_decimal IN (NULL, NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_float IN (1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_float c_float 4 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, 1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_float c_float 4 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_float IN (NULL, NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_bit IN (1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_bit c_bit 2 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, 1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_bit c_bit 2 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_bit IN (NULL, NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_date IN ('2009-09-01', '2009-09-02', '2009-09-03'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_date c_date 3 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_date c_date 3 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_date IN (NULL, NULL); -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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_datetime c_datetime 5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_datetime c_datetime 5 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_datetime IN (NULL, NULL); -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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_timestamp c_timestamp 4 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_timestamp c_timestamp 4 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_timestamp IN (NULL, NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_year IN (1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_year c_year 1 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, 1, 2, 3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_year c_year 1 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_year IN (NULL, NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_char IN ('1', '2', '3'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_char c_char 10 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, '1', '2', '3'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c_char c_char 10 NULL 3 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL); -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 +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 EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL); -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 +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 DROP TABLE t1; # # Bug#54477: Crash on IN / CASE with NULL arguments diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 2c654ea5e93..2fb148e558f 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 3 100.00 Using temporary; Using filesort +1 SIMPLE B NULL ALL NULL NULL NULL NULL 3 100.00 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 a5d986a0da5..10f6a3a1fac 100644 --- a/mysql-test/main/func_like.result +++ b/mysql-test/main/func_like.result @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 13 NULL 1 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 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a LIKE TIME'00:00:00'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL 1 100.00 Using where; Using index SELECT * FROM t1 WHERE a LIKE '00:00:00'; a 00:00:00 diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index ae48f11d465..20504b48417 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -1145,14 +1145,14 @@ EXPLAIN SELECT id FROM t1 WHERE a = 16307858876001849059; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 EXPLAIN SELECT id FROM t1 WHERE a = CONV('e251273eb74a8ee3', 16, 10); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 DROP TABLE t1; SELECT CHAR(NULL,121,83,81,'76') as my_column; my_column @@ -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 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 +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 2 100.00 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 explain select 1 as a from t1,(select encode(f1,f1) as b from t1) a; -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 +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 2 100.00 Using join buffer (flat, BNL join) +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 set optimizer_switch=@tmp_optimizer_switch; drop table t1; # diff --git a/mysql-test/main/gis-rt-precise.result b/mysql-test/main/gis-rt-precise.result index 1f018c9e1d4..f1260db70f0 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 4 100.00 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 f2ed437d860..a44f03421fc 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range g g 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range g g 34 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(a,Point(1,2)); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(Point(1,2),a); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(Point(1,2),a); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 100.00 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 b0f4db97bbd..4c23610eb21 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -963,8 +963,8 @@ COUNT(*) 1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL system p NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system p NULL NULL NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref p p 28 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref p p 28 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 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 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 41c2ec83dbd..7debedfc47c 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 INSERT INTO t1 VALUES (10); EXPLAIN INSERT INTO t1 SELECT * FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 REPLACE INTO t1 VALUES (10); EXPLAIN REPLACE INTO t1 SELECT * FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 +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 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 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 +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 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 Using where +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 DELETE FROM t1 WHERE a = 10; EXPLAIN DELETE FROM t1 USING t1, t2 WHERE t1.a = t2.a; -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 +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 8 100.00 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 d5e37081a15..34401a155aa 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c21 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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 +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 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.c22 1 100.00 +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.c42 1 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c12 1 100.00 +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c14 1 100.00 Using where +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 18 100.00 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 e76868e50cf..03a5af3ddc0 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 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 +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 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.userID 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 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 8 100.00 Using temporary; Using filesort explain select userid,count(*) from t1 group by userid desc order by null; -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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range spID spID 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range spID spID 5 NULL 3 100.00 Using where; Using index explain select spid,count(*) from t1 where spid between 1 and 2 group by spid; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range spID spID 5 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range spID spID 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range spID spID 5 NULL 3 100.00 Using where; Using index select spid,count(*) from t1 where spid between 1 and 2 group by spid; spid count(*) 1 1 @@ -291,8 +291,8 @@ id select_type table partitions type possible_keys key key_len ref rows filtered 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL score 3 NULL 8 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL score 3 NULL 8 100.00 Using index; Using filesort explain select sql_big_result score,count(*) from t1 group by score desc order by null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL score 3 NULL 8 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 4 100.00 Using temporary; Using filesort +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 4 100.00 Using temporary +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 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 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref PRIMARY,a PRIMARY 402 const,const 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref PRIMARY,a PRIMARY 402 const,const 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b b 2 NULL 10 100.00 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 1 test.t2.b 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 5 NULL 128 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 128 100.00 Using index EXPLAIN SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 128 100.00 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 partitions type possible_keys key key_len ref rows 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,i2 PRIMARY 4 NULL 1 100.00 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a < 2 ORDER BY a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,i2 PRIMARY 4 NULL 1 100.00 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a < 2 GROUP BY a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,i2 PRIMARY 4 NULL 1 100.00 Using where; Using index EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY,i2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 100.00 EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 100.00 # # 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 144 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 144 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 144 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 144 100.00 Using index EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY) IGNORE INDEX FOR ORDER BY (i2); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 100.00 Using index EXPLAIN SELECT a FROM t1 FORCE INDEX (i2); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 100.00 Using index EXPLAIN SELECT a FROM t1 USE INDEX (); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 100.00 EXPLAIN SELECT a FROM t1 USE INDEX () USE INDEX (i2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL i2 9 NULL 144 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL # NULL i2 # NULL # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL # NULL i2 # NULL # # Using index for group-by EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2) FORCE INDEX FOR GROUP BY (i2) GROUP BY a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL i2 4 NULL 145 100.00 Using index for group-by EXPLAIN SELECT a FROM t1 USE INDEX () IGNORE INDEX (i2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 100.00 EXPLAIN SELECT a FROM t1 IGNORE INDEX (i2) USE INDEX (); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL i2 9 NULL 144 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL i2 9 NULL 144 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL i2 9 NULL 144 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY,i2 PRIMARY 4 NULL 144 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 5 NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 5 NULL 2 100.00 EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2; -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 +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 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 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 +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 index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 8 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 10 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 10 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 10 NULL 6 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 10 NULL 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL a 5 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 10 NULL 6 100.00 Using index; Using temporary; Using filesort SELECT b from t2 GROUP BY b; b NULL @@ -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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a; MAX(t2.a) 2 @@ -1904,6 +1904,7 @@ key NULL key_len NULL ref NULL rows 2 +filtered 100.00 Extra Using filesort SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a; SUBSTRING(a,1,10) LENGTH(a) GROUP_CONCAT(b) @@ -1920,6 +1921,7 @@ key NULL key_len NULL ref NULL rows 2 +filtered 100.00 Extra Using temporary; Using filesort SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; SUBSTRING(a,1,10) LENGTH(a) @@ -1959,10 +1961,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 10 NULL 9 100.00 Using index +3 DEPENDENT SUBQUERY t12 NULL ref a a 10 func,func 2 100.00 Using index condition +2 DEPENDENT SUBQUERY t11 NULL ref a a 10 func,func 2 100.00 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 @@ -2015,8 +2017,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 100.00 Using index FLUSH STATUS; SELECT col1 AS field1, col1 AS field2 FROM t1 GROUP BY field1, field2;; @@ -2046,8 +2048,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 100.00 Using index; Using filesort FLUSH STATUS; SELECT SQL_BIG_RESULT col1 AS field1, col1 AS field2 FROM t1 GROUP BY field1, field2; @@ -2110,12 +2112,12 @@ field1 field2 1 3 explain select col1 f1, col1 f2 from t1 order by f2, f1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 100.00 Using index explain select col1 f1, col1 f2 from t1 order by f2, f1+0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 100.00 Using index; Using filesort select col1 f1, col1 f2 from t1 order by f2, f1+0; f1 f2 1 1 @@ -2140,8 +2142,8 @@ f1 f2 20 20 explain select col1 f1, col1 f2 from t1 group by f1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 100.00 Using index select col1 f1, col1 f2 from t1 group by f1; f1 f2 1 1 @@ -2166,8 +2168,8 @@ f1 f2 20 20 explain select col1 f1, col1 f2 from t1 group by f1, f2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 100.00 Using index select col1 f1, col1 f2 from t1 group by f1, f2; f1 f2 1 1 @@ -2192,8 +2194,8 @@ f1 f2 20 20 explain select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 100.00 Using index select col1 f1, col1 f2 from t1 group by f2 order by f2, f1; f1 f2 1 1 @@ -2218,8 +2220,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL idx 5 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 5 NULL 20 100.00 Using index select col1 f1, col1 f2 from t1 group by f1, f2 order by f2, f1; f1 f2 1 1 @@ -2251,24 +2253,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx 5 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx 5 NULL 7 100.00 Using index for group-by explain select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx 10 NULL 20 100.00 Using index explain select col1 f1, col1 f2 from t2 group by f1, 1+1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx 5 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx 10 NULL 20 100.00 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 @@ -2293,12 +2295,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL idx 10 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx 10 NULL 20 100.00 Using index explain select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx 10 NULL 20 100.00 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 @@ -2420,17 +2422,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 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 +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 Using temporary +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 SELECT t2.col2 FROM t2 JOIN t1 ON t1.col1 GROUP BY t2.col2; col2 8 @@ -2453,16 +2455,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 9 NULL 2 33.33 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 9 NULL 2 33.33 Using where; Using index for group-by SELECT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; MIN(a) b @@ -2530,9 +2532,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 5 100.00 Using where; Using index +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index SELECT t2.a FROM t2 STRAIGHT_JOIN t1 ON t2.a <> 0 WHERE t2.a <> 6 GROUP BY t2.a; a @@ -2546,9 +2548,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx idx 5 NULL 5 100.00 Using where; Using index +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 100.00 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 @@ -2785,9 +2787,9 @@ select max(a)+ (select col1 from t2 where t2.c=t1.c) from t1 group by t1.b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 101 100.00 Using temporary; Using filesort +2 DEPENDENT SUBQUERY t2 NULL ref c c 5 func 1 100.00 select max(a) + (select col1 from t2 where t2.c=t1.c) from t1 @@ -2882,8 +2884,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 partitions type possible_keys key key_len ref rows 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 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_innodb.result b/mysql-test/main/group_by_innodb.result index 39890618838..45a71a4cd43 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index PRIMARY,pk PRIMARY 4 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY,pk PRIMARY 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index PRIMARY,pk PRIMARY 4 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY,pk PRIMARY 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx3 idx3 5 NULL 100 100.00 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 e9bbf0c4c20..69111ff5569 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 100.00 Using index for group-by explain select a1, max(a2) from t1 group by a1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 65 NULL 5 100.00 Using index for group-by explain select a1, min(a2), max(a2) from t1 group by a1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 # NULL # 100.00 Using index for group-by explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 Using index for group-by explain select min(a2) from t1 group by a1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 100.00 Using index for group-by explain select a2, min(c), max(c) from t1 group by a1,a2,b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +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 12 100.00 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 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 +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 explain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b; -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 +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 explain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b; -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 +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 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 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 +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 17 100.00 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 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 +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 9 100.00 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 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 +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 9 100.00 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 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 +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 9 100.00 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 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 +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 9 100.00 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 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 +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 explain select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b; -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 +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 explain select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 9 100.00 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 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 +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 6 100.00 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 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 +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 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL 10 100.00 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 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 +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 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range NULL idx_t3_1 6 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range NULL idx_t3_1 6 NULL 4 100.00 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 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 +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 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL 6 100.00 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 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 +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 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL 10 100.00 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 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 +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 10 100.00 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 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 +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 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL # 100.00 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 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 +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 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +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 17 100.00 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 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 +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 17 100.00 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 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 +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 17 100.00 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 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 +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 17 100.00 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 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 +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 17 100.00 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 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 +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 17 100.00 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 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 +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 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +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 17 100.00 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 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 +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 17 100.00 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 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 +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 17 100.00 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 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 +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 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # 100.00 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 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 +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 # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # 100.00 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 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 +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 # 100.00 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 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 +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 # 100.00 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 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 +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 # 100.00 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 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 +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 # 100.00 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 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 +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 # 100.00 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 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 +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 # 100.00 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 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 +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 # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # 100.00 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 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 +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 # 100.00 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 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 +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 # 100.00 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 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 +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 # 100.00 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 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 +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 # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 func 1 100.00 +2 MATERIALIZED t2 NULL index NULL idx_t2_1 163 NULL 548 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 100.00 Using index +2 SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 88.69 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 88.69 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 88.69 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 88.69 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 512 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 548 88.69 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 100.00 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 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 +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 17 100.00 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 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 +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 163 NULL 17 100.00 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 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 +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 17 100.00 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 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 +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 163 NULL 13 100.00 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 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 +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 163 NULL 13 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +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 # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # 100.00 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 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 +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 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +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 17 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # 100.00 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 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 +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 # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 Using index for group-by explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 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 +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 explain select distinct b from t1 where (a2 >= 'b') and (b = 'a'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx_t1_2 147 NULL 512 25.00 Using where; Using index explain select distinct a1,a2,b from t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # 100.00 Using index for group-by explain select distinct a1,a2,b from t2 where (a2 >= 'b') and (b = 'a'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # 100.00 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 Using where; Using index for group-by explain select distinct b from t2 where (a2 >= 'b') and (b = 'a'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx_t2_2 146 NULL 548 23.20 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +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 17 100.00 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 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 +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 explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 Using where; Using index for group-by; Using temporary; Using filesort explain select distinct a1,a2,b from t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # 100.00 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 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 +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 # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL idx_t2_1 146 NULL # 100.00 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,19 +1957,19 @@ 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 17 100.00 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 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 +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 explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx_t1_2 147 NULL 512 25.00 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 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 @@ -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 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 +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 12 100.00 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 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 +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 12 100.00 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 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 +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 12 100.00 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 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 +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 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 147 NULL 9 100.00 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,11 +2072,11 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 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 512 100.00 Using temporary; Using filesort explain select a1,a2,b,d from t1 group by a1,a2,b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 100.00 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 partitions type possible_keys key key_len ref rows filtered Extra @@ -2096,32 +2096,32 @@ id select_type table partitions type possible_keys key key_len ref rows filtered 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx_t2_1 163 NULL 548 97.81 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx_t2_1 163 NULL 548 0.77 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx_t2_1 163 NULL 548 97.81 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx_t2_1 163 NULL 548 25.55 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 512 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 512 100.00 Using temporary; Using filesort explain select a1,a2,count(a2) from t1 group by a1,a2,b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx_t1_2 147 NULL 512 100.00 Using index explain extended select a1,a2,count(a2) from t1 where (a1 > 'a') group by a1,a2,b; 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL range NULL idxt4 147 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx_t1_2 147 NULL 512 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx_t1_1 130 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref PRIMARY PRIMARY 7 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 7 const 4 100.00 Using where; Using index EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 7 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 66 NULL 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a,b a 10 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY PRIMARY 12 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 12 NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range NULL a 5 NULL 6 100.00 Using index for group-by +2 UNION t1 NULL range NULL a 5 NULL 6 100.00 Using index for group-by +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL index NULL a 10 NULL 15 100.00 Using index +2 SUBQUERY t1 NULL range a a 5 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL index NULL a 10 NULL 15 100.00 Using index +2 SUBQUERY t1 NULL index NULL a 10 NULL 15 40.00 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 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 +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 range a a 5 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL index a a 10 NULL 15 100.00 Using where; Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1_outer.a 1 100.00 +2 MATERIALIZED t1 NULL range a a 5 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL range NULL a 5 NULL 6 100.00 Using index for group-by +2 SUBQUERY t1 NULL range a a 5 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer1 NULL ref a a 5 const 1 100.00 Using where; Using index +1 PRIMARY t1_outer2 NULL index NULL a 10 NULL 15 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL range a a 5 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer2 NULL index NULL a 10 NULL 15 100.00 Using index +2 SUBQUERY t1_outer NULL index NULL a 10 NULL 15 100.00 Using index +3 SUBQUERY t1 NULL range a a 5 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx 5 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL idx 5 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 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 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL break_it 10 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL break_it 10 NULL 7 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL break_it 10 NULL 20 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL break_it 10 NULL 20 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL foo 10 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL range NULL a 10 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL range NULL a 10 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL range NULL a 10 NULL 2 100.00 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL Impossible WHERE noticed after reading const tables +x x x x x x x x x x 100.00 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 partitions type possible_keys key key_len ref rows Extra -x 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 filtered Extra +x x x x x x x x x x NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL Impossible WHERE noticed after reading const tables +x x x x x x x x x x 100.00 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 partitions type possible_keys key key_len ref rows Extra -x 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 filtered Extra +x x x x x x x x x x NULL 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 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 +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 NULL 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 partitions type possible_keys key key_len ref rows Extra -x 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 filtered Extra +x x x x x x x x x x 100.00 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL Impossible WHERE noticed after reading const tables +x x x x x x x x x x 100.00 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 partitions type possible_keys key key_len ref rows Extra -x x x x x x x x x x Impossible WHERE +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 NULL 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 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 +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 t2 NULL index a a 5 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL b 5 NULL 10 100.00 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) +3 DEPENDENT SUBQUERY t1 NULL index b b 5 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL b 5 NULL 10 100.00 Using index +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL index b b 5 NULL 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index b b 8 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index b b 8 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index b b 8 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index b b 8 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index b b 8 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index b b 8 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref b b 4 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b b 4 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 8 NULL 9 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 b 8 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index b b 8 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index b b 8 NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL b 10 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range NULL b 10 NULL 3 100.00 Using where; Using index for group-by +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 50.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL b 10 NULL 18 100.00 Using where; Using index +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 50.00 Using where +2 SUBQUERY t1a NULL index NULL b 10 NULL 18 100.00 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1b NULL index NULL b 10 NULL 18 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 33 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 33 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 33 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 10 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 10 NULL 256 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 256 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 256 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 10 NULL 33 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1_1 NULL index NULL a 10 NULL 256 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t1_2 NULL index NULL a 10 NULL 256 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL a 15 NULL 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL a 5 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL a 10 NULL 17 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL a 15 NULL 17 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 5 NULL 1 0.39 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref a a 5 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL a 10 NULL 17 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL a 10 NULL 17 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 256 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 256 0.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL a 15 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 15 NULL 256 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 256 0.39 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 15 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 256 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NULL a 15 NULL 17 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 15 NULL 256 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 15 NULL 256 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL f1 5 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL index NULL a 10 NULL 7 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL index NULL a 10 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE faulty NULL ref b_and_c b_and_c 4 const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range break_it break_it 10 NULL 2 33.33 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL id 27 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL id 27 NULL 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL id 27 NULL 64 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 id 27 NULL 64 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL id 27 NULL 64 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 id 27 NULL 64 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL id 27 NULL 64 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 id 27 NULL 64 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select min(a) from t1 where a between "a" and "Cafeeeeeeeeeeeeeeeeeeeeeeeeee"; -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 +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 explain select min(a) from t1 where a between "abbbbbbbbbbbbbbbbbbbb" and "Cafe2"; -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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 4 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL b 10 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL index_t1_on_owner_id_and_foo 7 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL PRIMARY 4 NULL 10 100.00 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_innodb.result b/mysql-test/main/group_min_max_innodb.result index bd611bb02bd..abf93b20b59 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 5 NULL 4 Using index; Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 5 NULL 4 100.00 Using index; Using temporary explain select distinct f1, f2 from t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 5 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 2 NULL 2 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 2 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 2 NULL 2 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 2 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range k1 k1 5 NULL 31 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range k1 k1 5 NULL 31 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range k1 k1 5 NULL 31 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range k1 k1 5 NULL 31 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range k1 k1 5 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range k1 k1 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range k1 k1 5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range k2 k2 9 NULL 60 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range k2 k2 9 NULL 60 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index k2 k2 9 NULL 180 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index k2 k2 9 NULL 180 100.00 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 201d169e415..e521366ee52 100644 --- a/mysql-test/main/having.result +++ b/mysql-test/main/having.result @@ -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 partitions type possible_keys key key_len ref rows 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 EXPLAIN SELECT 0 AS x, a FROM t1 GROUP BY x,a HAVING x=1 AND a > 1; -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 +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 DROP table t1; CREATE TABLE t1 (a int PRIMARY KEY); CREATE TABLE t2 (b int PRIMARY KEY, a int); @@ -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 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 +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 SELECT MAX(t1.b) FROM t1,t2 WHERE t2.a < 0 HAVING MAX(t1.b) <> 6; MAX(t1.b) CREATE TABLE t3 ( f3 int) ; @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 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 8 100.00 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 fb1305ed024..11e7381fdb4 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 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 +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; 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 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 +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; 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 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 +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; 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 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 +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 Using where; Using temporary; Using filesort +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.x 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 Using where; Using temporary; Using filesort +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.x 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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; Using temporary; Using filesort +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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; Using temporary; Using filesort +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 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 +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; 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 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 +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; 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 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 +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; 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 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 +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; 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 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 5 100.00 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 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 +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; 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 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 +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; 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 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 +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; 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 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 +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; 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 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 +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; 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 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 +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; 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 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 +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; 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 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 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 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 +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; 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 partitions type possible_keys key key_len ref rows 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 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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; 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 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 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 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 +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; 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 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 +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; 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 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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 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 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 +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 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)) @@ -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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 84d7d68ba12..d73f5b09326 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 5 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 5 100.00 Using index ALTER TABLE t1 ALTER INDEX a IGNORED; EXPLAIN SELECT a FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 ALTER TABLE t1 ALTER INDEX a NOT IGNORED; EXPLAIN SELECT a FROM t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 5 100.00 Using index EXPLAIN SELECT a FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 +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 ALTER TABLE t2 ALTER INDEX a NOT IGNORED; EXPLAIN SELECT a FROM t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 5 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 ALTER TABLE t1 ALTER INDEX a NOT IGNORED; EXPLAIN SELECT a FROM t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL fulltext a a 0 1 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 4 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 4 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range key1 key1 34 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 34 NULL 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 150 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 150 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL key1 5 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL key1 5 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 EXPLAIN SELECT b FROM t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 Using index EXPLAIN SELECT * FROM t1 WHERE a = '04'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p9 ALL NULL NULL NULL NULL 8 100.00 Using where ALTER TABLE t1 ALTER INDEX a NOT IGNORED; EXPLAIN SELECT a FROM t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 Using index EXPLAIN SELECT * FROM t1 WHERE a = '04'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p9 ref a a 2 const 2 100.00 Using where ALTER TABLE t1 ALTER INDEX b IGNORED; EXPLAIN SELECT b FROM t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL k1 5 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 5 NULL 3 100.00 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 0f3bee51fb3..916b78a790c 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 100.00 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 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 const,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 16 100.00 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 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 8 test.t1.a,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.a,test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using temporary +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.x 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 16 100.00 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 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t3.x 2 100.00 Using where +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 16 100.00 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 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using temporary EXPLAIN FORMAT=JSON SELECT * FROM t3, ( @@ -4048,10 +4048,10 @@ FROM t2 WHERE t2.e<5 ) ; -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 +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 8 test.t1.b,test.t1.c 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 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 +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 12 test.t1.b,test.t1.c 1 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 12 100.00 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 57a123bb985..e902bb52f83 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Name,Population 35,4 NULL # 100.00 Using sort_intersect(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # 100.00 Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 300000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Name Name 35 NULL # 26.06 Using index condition; Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 7000000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # 56.29 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Population 35,4 NULL # 14.02 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Country,Name 4,3,35 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name,Country Name,Country,Population # NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country Population,PRIMARY,Country 4,4,3 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country Population,PRIMARY,Country 4,4,3 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country Country,PRIMARY 3,4 NULL # 33.54 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country Population,PRIMARY 4,4 NULL # 16.81 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country Population 4 NULL # 4.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Name,Population 35,4 NULL # 100.00 Using sort_intersect(Name,Population); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Country 4,3 NULL # 7.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country,Name Name 35 NULL # 1.75 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country Population 4 NULL # 1.62 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country Population 4 NULL # 4.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # 100.00 Using sort_intersect(Population,CountryID); Using where EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population > 1000000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL # 100.00 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 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 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name,CountryID,CountryName Name,Population 35,4 NULL # 100.00 Using sort_intersect(Name,Population); Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,f4 f4 35 NULL # 38.46 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_innodb.result b/mysql-test/main/index_intersect_innodb.result index a9ab36e49eb..6d7adc7bea3 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # 100.00 Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # 100.00 Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 300000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Name Name 35 NULL # 26.04 Using index condition; Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 7000000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Name,Country 4,35,3 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Country,Name 4,3,35 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Name,Country Name # NULL # 1.78 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # 100.00 Using sort_intersect(Population,Name); Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'M%' AND Population > 1500000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name Population,Name 4,35 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Population,Country 4,3 NULL # 12.45 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country,Name Name 35 NULL # 1.78 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range PRIMARY,Population,Country PRIMARY 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country PRIMARY 4 NULL # 7.16 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # 98.41 Using sort_intersect(Population,CountryID); Using where EXPLAIN SELECT * FROM City WHERE Country='USA' AND Population > 1000000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # 99.50 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL # 88.55 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 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 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Name,CountryID,CountryName Population,Name 4,35 NULL # 100.00 Using sort_intersect(Population,Name); Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f4 PRIMARY,f4 4,39 NULL # 100.00 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 179eac2fe50..0d1e20b6860 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,4 NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 10,10 NULL REF 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i3 i1,i3 10,10 NULL REF 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i2,i3 i3,i2 4,4 NULL REF 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref c,bd bd 10 const,const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c,bd bd 10 const,const 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY,key1 PRIMARY 8 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,key1 PRIMARY 8 NULL 10 0.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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 4,4 NULL 1 FLTRD 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref key1 key1 4 const 100 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1 key1 4 const 100 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL ROWS 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 FLTRD Using intersect(key1,pktail1ok); Using where explain select * from t1 where pktail2ok=1 and key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,pktail2ok key1,pktail2ok 4,4 NULL 1 FLTRD Using intersect(key1,pktail2ok); Using where explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 200 100.00 Using sort_union(pktail2ok,key1); Using where explain select * from t1 where pktail3bad=1 and key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1,pktail3bad key1 4 const 100 FLTRD Using where explain select * from t1 where pktail4bad=1 and key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1,pktail4bad key1 4 const 100 FLTRD Using where explain select * from t1 where pktail5bad=1 and key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1,pktail5bad key1 4 const 100 FLTRD Using where explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 4,4 NULL 1 FLTRD 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 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 +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 Using index +2 SUBQUERY t2 NULL index_merge f2,f3 f3,f2 2,5 NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # 100.00 +2 DERIVED t1 NULL index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # 100.00 +2 DERIVED t1 NULL ALL PRIMARY NULL NULL NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref i,v i 5 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i,v i 5 const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,b b,PRIMARY 5,3074 NULL 5 100.00 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_myisam.result b/mysql-test/main/index_merge_myisam.result index e4cd8b769ca..f9234230b82 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL range i1 i1 4 NULL 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL range i1 i1 4 NULL 5 100.00 Using index condition explain select * from t0 where key1 < 3 or key2 > 920 and key2 < 924; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL i1 NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL i1 NULL NULL NULL 1024 100.00 Using where explain select * from t0 where (key1 < 3 or key2 <4) and key3 = 50; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ref i1,i2,i3 i3 4 const 1 100.00 Using where explain select * from t0 use index (i1,i2) where (key1 < 3 or key2 <4) and key3 = 50; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 5 0.10 Using sort_union(i1,i2); Using where explain select * from t0 where (key1 > 1 or key2 > 2); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL i1,i2 NULL NULL NULL 1024 100.00 Using where explain select * from t0 force index (i1,i2) where (key1 > 1 or key2 > 2); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 1024 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 15 100.00 Using sort_union(i1,i2); Using where explain select * from t0 where key2 = 45 or key1 <=> null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL range i1,i2 i2 4 NULL 1 100.00 Using index condition explain select * from t0 where key2 = 45 or key1 is not null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL i1,i2 NULL NULL NULL 1024 100.00 Using where explain select * from t0 where key2 = 45 or key1 is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ref i2 i2 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ref i2 i2 4 const 1 100.00 explain select * from t0 where key2=10 or key3=3 or key4 <=> null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i2,i3,i4 i2,i3 4,4 NULL 2 100.00 Using union(i2,i3); Using where explain select * from t0 where key2=10 or key3=3 or key4 is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i2,i3 i2,i3 4,4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i4 i2,i3 4,4 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i3,i4 i1,i3 4,4 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i4,i5,i6 i1,i2 4,4 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3 i1,i2 4,4 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i4,i5,i6 i5,i6 4,4 NULL 2 100.00 Using sort_union(i5,i6); Using where explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 100); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3 i1,i2 4,4 NULL 4 9.18 Using sort_union(i1,i2); Using where explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 1000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3 i1,i2 4,4 NULL 4 89.45 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL i1,i2,i3 NULL NULL NULL 1024 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL i1,i2,i3 NULL NULL NULL 1024 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3 i1,i2 4,4 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6,i7,i8 i1,i2,i5,i6 4,4,4,4 NULL 15 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6,i7,i8 i3,i5,i7,i8 4,4,4,4 NULL 16 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6,i7 i3,i5 4,4 NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2,i3,i5,i6 i3,i5 4,4 NULL 1024 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL i1,i2,i3,i5,i6 NULL NULL NULL 1024 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i8 i1,i8 4,4 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index_merge i1_3,i2_3 i1_3,i2_3 4,4 NULL 2 100.00 Using sort_union(i1_3,i2_3); Using where explain select key3 from t2 where key1 < 600 or key2 < 600; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index i1_3,i2_3 i321 12 NULL 1024 100.00 Using where; Using index explain select key7 from t2 where key1 <100 or key2 < 100; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index_merge i1_3,i2_3 i1_3,i2_3 4,4 NULL 186 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL index_merge i1a,i1b i1a,i1b 4,4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ref i2_1,i2_2 i2_1 4 const 9 100.00 Using where explain select * from t4 where key2 = 1 and (key2_1 = 1 or key2_2 = 5); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ref i2_1,i2_2 i2_1 4 const 9 100.00 Using where explain select * from t4 where key2_1 = 1 or key2_2 = 5; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1024 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 2 100.00 Using union(i1,i2); Using where +1 SIMPLE t1 NULL ref i1 i1 4 test.t0.key1 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 2 100.00 Using union(i1,i2); Using where +1 SIMPLE t1 NULL ref i1 i1 4 test.t0.key1 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 2 17.77 Using union(i1,i2); Using where +1 SIMPLE t1 NULL ref i1 i1 4 test.t0.key1 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ref i1,i2 i1 4 const 1 0.29 Using where +1 SIMPLE t1 NULL ref i1 i1 4 const 1 100.00 explain select * from t0,t1 where t0.key1 = 5 and (t1.key1 = t0.key1 or t1.key8 = t0.key1); -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ref i1 i1 4 const 1 100.00 +1 SIMPLE t1 NULL index_merge i1,i8 i1,i8 4,4 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL range i1 i1 4 NULL 2 100.00 Using index condition +1 SIMPLE t1 NULL ALL i1,i8 NULL NULL NULL 1024 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 2 100.00 Using union(i1,i2); Using where +2 UNION t1 NULL index_merge i1,i3 i1,i3 4,4 NULL 4 100.00 Using sort_union(i1,i3); Using where +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +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 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 99.51 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL index_merge i1,i2 i1,i2 4,4 NULL 5 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL index_merge i1,i2 i1,i2 4,4 NULL 1010 100.00 Using sort_union(i1,i2); Using where +1 SIMPLE B NULL index_merge i1,i2 i1,i2 4,4 NULL 1010 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL index_merge i1,i2 i1,i2 4,4 NULL 1021 100.00 Using union(i1,i2); Using where +1 SIMPLE B NULL index_merge i1,i2 i1,i2 4,4 NULL 1021 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL index_merge i1,i2,i3,i4,i5,i6,i7?,i8 i2,i3,i4,i5,i6,i7?,i8 X NULL # 100.00 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 # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge cola,colb cola,colb 3,3 NULL 32 100.00 Using intersect(cola,colb); Using where explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'bar'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge cola,colb cola,colb 3,3 NULL 32 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL # 100.00 Using intersect(a,b); Using where explain select * from t3 where a=1 and b=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index_merge a,b a,b 5,5 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index_merge a,b a,b 5,5 NULL # 100.00 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 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) +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 +2 MATERIALIZED t3 NULL ALL a,b NULL NULL NULL 1002 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 131,131 NULL 64 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 77 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 77 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 77 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 83 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 77 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 137 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 148 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key3,key1,key2,key4 5,5,5,5 NULL 159 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 24.02 Using where explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref sta_swt12a,sta_swt1a,sta_swt2a,sta_swt21a,st_a sta_swt21a 12 const,const,const 971 100.00 explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref stb_swt1a_2b,stb_swt1b,st_b stb_swt1a_2b 8 const,const 3879 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 95.91 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 95.91 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type ta_or_ba_or_ble pa_or_brtitions type possia_or_ble_keys key key_len ref rows filtered Extra_or_b +1 SIMPLE t2 NULL ref a_or_b,a_or_b a_or_b 6 const 4 12.50 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref a a 6 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 6 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 4,4 NULL 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref key1,key2 key1 5 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1,key2 key1 5 const 4 25.81 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i2 i1,i2 10,10 NULL REF 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i1,i3 i1,i3 10,10 NULL REF 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge i2,i3 i3,i2 4,4 NULL REF 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref c,bd bd 10 const,const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c,bd bd 10 const,const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,key1 PRIMARY 8 NULL 7 0.30 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 4,4 NULL 1 FLTRD 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref key1 key1 4 const 91 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1 key1 4 const 91 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref PRIMARY,key1 key1 4 const ROWS Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY,key1 key1 4 const ROWS 99.99 Using where set optimizer_switch=@tmp_index_merge_ror_cpk; explain select * from t1 where pktail1ok=1 and key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1,pktail1ok pktail1ok 4 const 76 FLTRD Using where explain select * from t1 where pktail2ok=1 and key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1,pktail2ok pktail2ok 4 const 82 FLTRD Using where explain select * from t1 where (pktail2ok=1 and pk1< 50000) or key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,key1,pktail2ok pktail2ok,key1 8,4 NULL 173 100.00 Using sort_union(pktail2ok,key1); Using where explain select * from t1 where pktail3bad=1 and key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1,pktail3bad pktail3bad 4 const 73 FLTRD Using where explain select * from t1 where pktail4bad=1 and key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1,pktail4bad pktail4bad 4 const 82 FLTRD Using where explain select * from t1 where pktail5bad=1 and key1=10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1,pktail5bad pktail5bad 4 const 69 FLTRD Using where explain select pk1,pk2,key1,key2 from t1 where key1 = 10 and key2=10 limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 4,4 NULL 1 FLTRD 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 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 +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 +2 SUBQUERY t2 NULL ref f2,f3 f3 2 const 2 50.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a,b NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a,b NULL NULL NULL 1000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 38 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a,b NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a,b NULL NULL NULL 1000 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a,b NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a,b NULL NULL NULL 1000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 38 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b,c,d a,b 5,5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b,c,d c,d 5,5 NULL 100 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 1 48.02 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a,b a 5 const 49 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 5 const 49 0.98 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a,b a 5 const 49 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 5 const 49 0.98 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 1 48.02 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 1 48.02 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b,c a,b,c 5,5,5 NULL 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b,c a,c 5,5 NULL 54 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b,c a,c 5,5 NULL 54 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,c1,i,c2 NULL NULL NULL 69 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 13 100.00 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 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 +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 t0 NULL index_merge i1,i2,i8 i1,i2 4,4 NULL 2 99.61 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 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 +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 t0 NULL index_merge i1,i2,i8 i1,i2 4,4 NULL 2 99.61 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 753d4fefa72..7ef17aa5048 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE # NULL ALL NULL NULL NULL NULL NULL NULL +1 SIMPLE # NULL ALL NULL 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE # NULL ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE # NULL ALL NULL 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 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 +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 Open_frm_only; Scanned all databases; Using filesort explain select * from (select table_name from information_schema.tables) as a; -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 +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 tables NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE views NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Open_frm_only; Scanned 0 databases explain select * from information_schema.tables; -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 +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 Open_full_table; Scanned all databases explain select * from information_schema.collations; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE collations NULL ALL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE collations NULL ALL NULL NULL NULL NULL NULL NULL explain select * from information_schema.tables where table_schema='test' and table_name= 't1'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tables NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tables NULL ALL NULL TABLE_SCHEMA NULL 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL NULL NULL NULL Using where; Skip_open_table; Scanned 0 databases +1 SIMPLE b NULL ALL NULL 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 @@ -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 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 +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 explain select count(*) from information_schema.columns; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE columns NULL ALL NULL NULL NULL NULL NULL NULL Open_frm_only; Scanned all databases explain select count(*) from information_schema.views; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE views NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE KEY_COLUMN_USAGE NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE PARTITIONS NULL ALL NULL TABLE_NAME NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE REFERENTIAL_CONSTRAINTS NULL ALL NULL CONSTRAINT_SCHEMA NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE TABLE_CONSTRAINTS NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE TRIGGERS NULL ALL NULL EVENT_OBJECT_SCHEMA NULL 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; diff --git a/mysql-test/main/innodb_bug878769.result b/mysql-test/main/innodb_bug878769.result index c4f471b28ae..cc8c4760791 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index col_int_key col_int_key 5 NULL 12 100.00 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 100.00 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 cca1eafc8ad..44582447415 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 100.00 Using index ++1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 0.08 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 1 100.00 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 16.72 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 3 100.00 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 16.64 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 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 + 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 ++1 SIMPLE lineitem NULL ref i_l_shipdate i_l_shipdate 4 const 6 100.00 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 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 + 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 ++1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 16.64 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 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 + 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 ++1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 0.08 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 100.00 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 100.00 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 3 100.00 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 100.00 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered 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 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where ++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 Using union(intersect(i_l_shipdate,PRIMARY),intersect(i_l_receiptdate,PRIMARY)); Using where 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE lineitem NULL range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # 100.00 Using where; Using index for group-by ++1 SIMPLE lineitem NULL range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # 100.00 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE lineitem NULL range i_l_suppkey i_l_suppkey 5 NULL # 100.00 Using where; Using index for group-by ++1 SIMPLE lineitem NULL range i_l_suppkey i_l_suppkey 5 NULL # 100.00 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra + 1 SIMPLE part NULL range i_p_retailprice i_p_retailprice 9 NULL # 100.00 Using where; Using index + 1 SIMPLE orders NULL ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # 100.00 Using index +-1 SIMPLE lineitem NULL ref i_l_partkey i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey # 100.00 Using index ++1 SIMPLE lineitem NULL ref i_l_partkey i_l_partkey 5 dbt3_s001.part.p_partkey # 100.00 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +-1 SIMPLE part NULL eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1 100.00 ++1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 5 100.00 ++1 SIMPLE part NULL ref i_p_size i_p_size 5 const 5 100.00 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 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 + 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.00 Using where +-1 SIMPLE t3 NULL ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # 100.00 Using index ++1 SIMPLE t3 NULL ref PRIMARY,col1 col1 8 test.t1.a,test.t1.a # 100.00 Using where; Using index drop table t1,t2,t3; # # Bug mdev-4340: performance regression with extended_keys=on @@ -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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE t1 NULL range index_date_updated index_date_updated 13 NULL # 0.80 Using index condition ++1 SIMPLE t1 NULL ref index_date_updated index_date_updated 5 const # 100.00 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 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 + id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE t2 NULL range index_date_updated index_date_updated 13 NULL # 0.80 Using index condition ++1 SIMPLE t2 NULL ref index_date_updated index_date_updated 5 const # 100.00 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 a42d187e9f0..8cd5276d282 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE lineitem NULL const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL const PRIMARY PRIMARY 8 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate # NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range i_l_suppkey i_l_suppkey 5 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE part NULL range i_p_retailprice i_p_retailprice 9 NULL # 100.00 Using where; Using index +1 SIMPLE orders NULL ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # 100.00 Using index +1 SIMPLE lineitem NULL ref i_l_partkey i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 SIMPLE part NULL eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1 100.00 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 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) +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 Using join buffer (flat, BNL join) +2 MATERIALIZED s1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED s2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL index a,b b 7 NULL 10 100.00 Using index +1 PRIMARY t1 NULL ref b b 3 test.t.b 2 100.00 Using index; Start temporary +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 11 100.00 Using index; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t.a 1 100.00 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 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) +id select_type 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 hash_ALL NULL #hash#$hj 5 test.t1.a 2 100.00 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 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 +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.00 +1 SIMPLE t2 NULL eq_ref a a 4 test.t1.a # 100.00 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 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 +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.00 Using where +1 SIMPLE t3 NULL ref col1 col1 8 test.t1.a,test.t1.a # 100.00 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 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 +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.00 Using where +1 SIMPLE t3 NULL ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY,name_title name_title 261 const,const 1 100.00 +1 SIMPLE t2 NULL ref page_timestamp page_timestamp 4 const 10 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index b PRIMARY 8 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index b PRIMARY 8 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range b b 9 NULL 3 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range b b 9 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index b PRIMARY 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b PRIMARY 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index b PRIMARY 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b PRIMARY 8 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range index_date_updated index_date_updated 13 NULL # 0.80 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range index_date_updated index_date_updated 13 NULL # 0.80 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL k1 23 NULL # Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL k1 23 NULL # 100.00 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_icp.result b/mysql-test/main/innodb_icp.result index 39d9ed3b3b0..b7535c1c695 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 4 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 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c1 c1 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c1 c1 8 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c1 c1 12 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL c1 NULL NULL NULL 100 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL c1 NULL NULL NULL 100 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,k1 k1 5 NULL 4 37.50 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # 100.00 Using where +2 DEPENDENT SUBQUERY it NULL eq_ref PRIMARY PRIMARY 4 func # 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL index NULL PRIMARY 4 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 4 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 4 100.00 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 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) +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 +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 100.00 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 100.00 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 13 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 13 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL # 100.00 Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL # 100.00 Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL PRIMARY,c NULL NULL NULL 64 100.00 Using where +1 PRIMARY t2 NULL ref g g 5 test.t.c 18 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL index PRIMARY d 3 NULL 64 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1 idx1 10 NULL 2 100.00 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 8feb823446c..a0d0630be29 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range kp1 kp1 5 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range kp1 kp1 5 NULL 11 100.00 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 77ee648871b..5a5c85c4449 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 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 +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 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 8 test.t2.a 1 100.00 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 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 +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 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 28 test.t2.a,test.t2.b 1 100.00 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 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 +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 eq_ref PRIMARY PRIMARY 28 test.t2.a,test.t2.b 1 100.00 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 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 +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 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 30 test.t2.a,test.t2.b 1 100.00 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 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 +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 Using where +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 26 test.t2.a 1 100.00 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 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 +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 Using where +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 8 test.t2.a,test.t2.b 1 100.00 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 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 +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 Using where +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 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 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 +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 Using where +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t1 NULL ref kp1 kp1 32 test.t2.a 1 100.00 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 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 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 25 test.t1.id # 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL # 100.00 set join_cache_level= @tmp_mdev5037; drop table t0,t1,t2; # diff --git a/mysql-test/main/insert_returning.result b/mysql-test/main/insert_returning.result index df03366f3f4..0f1ed39516c 100644 --- a/mysql-test/main/insert_returning.result +++ b/mysql-test/main/insert_returning.result @@ -58,8 +58,8 @@ id1 val1 6 f 7 h EXPLAIN INSERT INTO t1(id1,val1) VALUES (8,'i') RETURNING *; -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 +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 EXTENDED INSERT INTO t1(id1,val1) VALUES(9,'j') RETURNING id1; 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 @@ -146,8 +146,8 @@ id1 val1 13 o 14 p EXPLAIN INSERT INTO t1 VALUES(15,'q'),(16,'r') RETURNING *; -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 +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 EXTENDED INSERT INTO t1 VALUES (17,'s'),(18,'t') RETURNING *; 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 @@ -230,8 +230,8 @@ id 4 EXPLAIN INSERT INTO ins_duplicate(id,val) VALUES (2,'b') ON DUPLICATE KEY UPDATE val='h' RETURNING val; -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 +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 EXTENDED INSERT INTO ins_duplicate(id,val) VALUES (2,'b') ON DUPLICATE KEY UPDATE val='i' RETURNING val; id select_type table partitions type possible_keys key key_len ref rows filtered Extra @@ -315,8 +315,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 INSERT t1 NULL ALL NULL NULL NULL NULL NULL 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 EXTENDED INSERT INTO t1 SET id1=10, val1='j' RETURNING val1; 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 @@ -399,8 +399,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL const PRIMARY PRIMARY 4 const 1 +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 EXPLAIN EXTENDED INSERT INTO t1 SELECT * FROM t1 WHERE id1=9 RETURNING val1; 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 diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result index d5fb41202d8..aa09111edae 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 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 +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 ref ix_c ix_c 13 const 1 100.00 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/intersect.result b/mysql-test/main/intersect.result index 5d85a1f5ffc..c461faaf8ab 100644 --- a/mysql-test/main/intersect.result +++ b/mysql-test/main/intersect.result @@ -18,11 +18,11 @@ 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 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 +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 EXPLAIN extended (select a,b from t1) intersect (select c,d from t2) intersect (select e,f from t3); 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 @@ -306,11 +306,11 @@ a b a b 2 2 EXPLAIN (select a,b from t1) intersect (select c,e from t2,t3); -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 +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 EXPLAIN extended (select a,b from t1) intersect (select c,e from t2,t3); 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 diff --git a/mysql-test/main/intersect_all.result b/mysql-test/main/intersect_all.result index 2b80fc73975..82fc7363beb 100644 --- a/mysql-test/main/intersect_all.result +++ b/mysql-test/main/intersect_all.result @@ -30,11 +30,11 @@ 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 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 +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 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 partitions type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 @@ -338,11 +338,11 @@ a b 2 2 2 2 EXPLAIN (select a,b from t1) intersect all (select c,e from t2,t3); -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 +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 EXPLAIN extended (select a,b from t1) intersect all (select c,e from t2,t3); 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 diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result index d97c1f27ab7..86b13d93101 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const b b 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const b b 5 const 1 100.00 select * from t1 where b=3; a 3 explain select * from t1 where c=3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const c c 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const c c 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 SIMPLE t1 NULL eq_ref b,c b 5 test.t2.c 1 100.00 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 27c55a195bc..5865ba43ff1 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL invisible NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL invisible NULL NULL NULL 7 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL invisible NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL invisible NULL NULL NULL 7 100.00 Using where create index invisible on t1(c); explain select * from t1 where invisible =9; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL invisible_2 NULL NULL NULL 7 100.00 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 313ceff6e7e..e705c765f22 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY NULL NULL NULL 1 100.00 Impossible ON condition +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 32 100.00 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 16 100.00 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 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 +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 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a,b NULL NULL NULL 1000 19.80 Using where +1 SIMPLE t3 NULL ref b b 5 test.t2.b 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +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 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 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 +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 +1 SIMPLE A NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where +1 SIMPLE B NULL eq_ref PRIMARY PRIMARY 4 test.A.b 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a LIMIT 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 128 100.00 Using where; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 EXPLAIN SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 128 100.00 Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 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) +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 ref a a 5 test.t1.a 2 100.00 Using where; Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 0 0.00 Using where +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 0 0.00 Using where +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 0 0.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) SELECT * FROM t1 JOIN t2 ON t1.a = t2.a @@ -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 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 +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 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 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 +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 EXPLAIN SELECT * FROM t1 JOIN t2 ON t1.v = t2.v; -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 +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 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 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) +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 const PRIMARY PRIMARY 4 const 1 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 4 100.00 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 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) +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 PRIMARY NULL NULL NULL 3 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 t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +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 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t4.ref_t1 1 100.00 +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type 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 f2 NULL NULL NULL 2 100.00 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 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 +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 t2 NULL ALL PRIMARY NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE DU NULL system dog_id NULL NULL NULL 1 100.00 +1 SIMPLE D NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE DSAR NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE DSA NULL ref PRIMARY PRIMARY 4 const 3 100.00 Using where; Using index +1 SIMPLE DT NULL ALL t_id NULL NULL NULL 2 100.00 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; @@ -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 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) +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 temporary; Using filesort +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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) +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 temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 eq_ref a a 5 test.t0.a 1 100.00 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 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 +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 +1 SIMPLE t2 NULL range PRIMARY,key1,key2 PRIMARY 8 NULL 219 99.90 Using index condition; Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ref a a 5 test.t2.key2 1 100.00 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 747249f5e56..ed5bb94e8a1 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.77 Using where +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 87.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 55.23 Using where +1 SIMPLE CountryLanguage NULL ALL NULL NULL NULL NULL 984 17.09 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 4.17 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.77 Using where +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 87.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 55.23 Using where +1 SIMPLE CountryLanguage NULL ALL NULL NULL NULL NULL 984 17.09 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 4.17 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.77 Using where +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 87.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 55.23 Using where +1 SIMPLE CountryLanguage NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 984 17.09 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 4.17 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.77 Using where +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 87.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 55.23 Using where +1 SIMPLE CountryLanguage NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 984 17.09 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 4.17 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.00 Using where +1 SIMPLE City NULL hash_range City_Population #hash#$hj:City_Population 3:4 world.Country.Code 24 0.59 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.00 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 2.35 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.77 Using where +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 87.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 55.23 Using where +1 SIMPLE CountryLanguage NULL ALL NULL NULL NULL NULL 984 17.09 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 4.17 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.77 Using where +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 87.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 55.23 Using where +1 SIMPLE CountryLanguage NULL ALL NULL NULL NULL NULL 984 17.09 Using where; Using join buffer (flat, BNL join) +1 SIMPLE City NULL ALL NULL NULL NULL NULL 4079 4.17 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.77 Using where +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 87.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 55.23 Using where +1 SIMPLE CountryLanguage NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 984 17.09 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 4.17 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 3.77 Using where +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 87.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 55.23 Using where +1 SIMPLE CountryLanguage NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 984 17.09 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City NULL hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 4.17 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 87.60 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 55.23 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%) 18.80 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 87.60 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 32.64 Using where +1 SIMPLE CountryLanguage NULL hash_ALL PRIMARY #hash#PRIMARY 33 world.Country.Code,const 984 0.10 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 87.60 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 55.23 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%) 18.80 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 87.60 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 32.64 Using where +1 SIMPLE CountryLanguage NULL hash_ALL PRIMARY #hash#PRIMARY 33 world.Country.Code,const 984 0.10 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range Name Name 52 NULL # 32.64 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE City NULL hash_range Population,Country #hash#Country:Population 3:4 world.Country.Code # 0.74 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range Name Name 52 NULL 17 32.64 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 2.35 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 55.23 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%) 18.80 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 32.64 Using where +1 SIMPLE CountryLanguage NULL eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 55.23 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%) 18.80 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 32.64 Using where +1 SIMPLE CountryLanguage NULL eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 55.23 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%) 18.80 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 32.64 Using where +1 SIMPLE CountryLanguage NULL eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 55.23 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%) 18.80 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL ALL NULL NULL NULL NULL 239 32.64 Using where +1 SIMPLE CountryLanguage NULL eq_ref PRIMARY PRIMARY 33 world.Country.Code,const 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 55.23 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%) 18.80 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 87.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 55.23 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%) 18.80 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL hash_ALL Population,Country #hash#Country 3 world.Country.Code 4079 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 55.23 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%) 18.80 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 55.23 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%) 18.80 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 55.23 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%) 18.80 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Country NULL NULL NULL 4079 4.17 Using where +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 55.23 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%) 18.80 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range PRIMARY,Name Name 52 NULL 10 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY City NULL ref Population,Country Country 3 world.Country.Code 17 87.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country Population 4 NULL # 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country # 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range Name Name 302 NULL 15 32.64 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 0.59 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE Country NULL range Name Name 302 NULL 15 32.64 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 2.35 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t5 NULL ref PRIMARY,t5_formattypeid t5_formattypeid 4 const 1 100.00 +1 SIMPLE t1 NULL ref t1_affiliateid,t1_metaid t1_affiliateid 4 const 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.metaid 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t7 NULL ref PRIMARY PRIMARY 4 test.t1.metaid 1 100.00 Using index +1 SIMPLE t8 NULL eq_ref PRIMARY PRIMARY 4 test.t7.artistid 1 100.00 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 50.00 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 100.00 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 100.00 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 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t11 NULL eq_ref PRIMARY PRIMARY 4 test.t10.genreid 1 100.00 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 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 +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 where +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 Using index +1 SIMPLE t3 NULL ref idx idx 5 test.t2.b2 5 100.00 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 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 +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 where +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 Using index +1 SIMPLE t3 NULL ref idx idx 5 test.t2.b2 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 3 100.00 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL ref idx idx 5 test.t1.a 2 100.00 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 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 +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 ref i_a i_a 4 test.t1.a 2 100.00 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 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 +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 ref i_a i_a 4 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 8 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t2 NULL ref i_a i_a 5 test.t1.a 2 100.00 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 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) +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) 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 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) +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; 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 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 +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 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2050 100.00 Using where +1 SIMPLE t2 NULL ref idx idx 5 test.t1.a 640 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 16384 100.00 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 2 100.00 Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 test.t1.a 1 100.00 Using index +1 SIMPLE t3 NULL ref idx idx 16 test.t1.a,test.t2.b 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 2 100.00 Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 test.t1.a 1 100.00 Using index +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 24 100.00 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 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 +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 ref f1 f1 4 test.t1.f1 3 100.00 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 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 +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 ref f1 f1 4 test.t1.f1 3 100.00 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 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 +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 ref f1 f1 4 test.t1.f1 3 100.00 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 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 +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 ref f1 f1 4 test.t1.f1 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1 idx1 5 const 4 100.00 Using where; Using index; Using temporary; Using filesort +1 SIMPLE t2 NULL ref idx2 idx2 5 test.t1.id1 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1 idx1 5 const 4 100.00 Using where; Using index; Using temporary; Using filesort +1 SIMPLE t2 NULL ref idx2 idx2 5 test.t1.id1 2 100.00 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 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 +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 +1 SIMPLE t2 NULL ref idx idx 5 test.t1.b 1 100.00 +1 SIMPLE t4 NULL ref idx idx 5 test.t1.c 1 100.00 +1 SIMPLE t3 NULL ref idx idx 5 test.t1.d 1 100.00 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 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 +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 +1 SIMPLE t2 NULL ref idx idx 5 test.t1.b 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL ref idx idx 5 test.t1.c 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref idx idx 5 test.t1.d 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 349 100.00 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 8 test.t1.id3 1 100.00 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 100.00 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 100.00 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 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL int_key 4 NULL 14 100.00 Using index +1 SIMPLE t2 NULL index NULL int_key 4 NULL 2 100.00 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 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) +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 t1 NULL index NULL PRIMARY 4 NULL 4 100.00 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 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) +id select_type 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 join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type 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 join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type 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 t3 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 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 3 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.carrier 1 100.00 Using where +1 SIMPLE t4 NULL ref carrier_id carrier_id 5 test.t3.id 2 100.00 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 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 +id select_type 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 ref b b 5 test.t1.b 2 100.00 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 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 +id select_type 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 ref b b 5 test.t1.b 2 100.00 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 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 +id select_type 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 ref b b 5 test.t1.b 2 100.00 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 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 +id select_type 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 ref b b 103 test.t1.b 2 100.00 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 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 +id select_type 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 ref b b 103 test.t1.b 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE s NULL ref idx idx 19 test.t.c 1 100.00 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 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) +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 0 0.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 0 0.00 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 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) +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 0 0.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 0 0.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 0 0.00 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 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) +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 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL hash_ALL idx #hash#idx 3 test.t2.u 40 12.50 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 100.00 Using where +1 SIMPLE t1 NULL ref idx2 idx2 3 test.t3.v 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 100.00 Using where +1 SIMPLE t1 NULL ref idx2 idx2 3 test.t3.v 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 100.00 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY,idx2 PRIMARY 4 test.t2.i 1 100.00 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 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 5.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t1 NULL hash_ALL idx2 #hash#idx2 3 test.t3.v 44 12.27 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index idx1 idx2 7 NULL 20 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t3 NULL hash_ALL PRIMARY,idx2 #hash#PRIMARY 4 test.t2.i 20 5.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t1 NULL hash_ALL idx2 #hash#idx2 3 test.t3.v 44 12.27 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 +1 SIMPLE t1 NULL ref cu cu 33 func 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 +1 SIMPLE t1 NULL hash_index cu #hash#cu:cu 33:33 func 10 20.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL idx NULL NULL NULL 15 100.00 Using where +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 5 test.t2.a 36 100.00 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 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 +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 +1 SIMPLE t2 NULL ref idx idx 13 test.t1.v 3 100.00 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 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 +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 +1 SIMPLE t2 NULL ref idx idx 13 func 3 100.00 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 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) +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 +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 13 test.t1.v 36 10.71 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 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) +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 +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 13 func 36 10.71 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index idx idx 13 NULL 7 100.00 Using where; Using index +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 1003 test.t1.v 36 10.01 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t3 NULL hash_ALL idx #hash#idx 1002 func 64 10.01 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL hash_ALL idx #hash#idx 515 test.t1.a 24 10.02 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 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 +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 1 100.00 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 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) +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 1 100.00 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 @@ -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 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) +id select_type 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#$hj 5 test.t1.c1 1 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 5 test.t3.b3 1 100.00 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type 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 eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 100.00 Using where +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type 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 PRIMARY NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 100.00 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 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) +id select_type 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 PRIMARY NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL hash_ALL PRIMARY #hash#PRIMARY 4 test.t2.a2 1 100.00 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 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 +id select_type 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 PRIMARY NULL NULL NULL 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 100.00 Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 100.00 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 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 +id select_type 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 PRIMARY NULL NULL NULL 1 100.00 Using where +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 100.00 Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a2 1 100.00 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 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) +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 hash_ALL idx #hash#idx 35 test.t1.a 30 10.28 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 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) +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; Rowid-ordered scan +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 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 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) +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 index condition; Rowid-ordered scan +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range f1,f2 f2 13 NULL 10 30.00 Using where +1 SIMPLE t2 NULL ref f3 f3 67 test.t1.f2 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range f1,f2 f2 13 NULL 10 30.00 Using where +1 SIMPLE t2 NULL ref f3 f3 67 test.t1.f2 2 100.00 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 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 +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 +1 SIMPLE t2 NULL ref idx idx 5 const 4 100.00 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 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) +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 +1 SIMPLE t2 NULL hash_range idx #hash#idx:idx 5:5 const 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL f1 NULL NULL NULL 2 100.00 Using where +1 SIMPLE t2 NULL hash_ALL f1 #hash#f1 13 test.t1.f1 20 10.71 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 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) +id select_type 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 hash_ALL idx #hash#idx 4 test.t1.v 16 12.50 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 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 +id select_type 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 4 test.t1.v 2 100.00 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 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 +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 Using where; Start temporary +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 1 100.00 End temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 Using where; Start temporary +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t2.a 1 100.00 End temporary +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 ref c c 5 test.t1.b 2 100.00 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 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) +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 hash_index c #hash#c:c 5:5 test.t1.b 8 25.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const idx idx 5 const 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const idx idx 5 const 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY t3 NULL hash_ALL NULL #hash#$hj 5 const 2 100.00 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 100.00 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 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 +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 +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 +1 PRIMARY t3 NULL hash_ALL NULL #hash#$hj 5 const 2 100.00 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 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) +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 t2 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL hash_ALL NULL #hash#$hj 5 const 2 100.00 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 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 +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 t3 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL range a,c a 5 NULL 2 100.00 Using index condition; Using where; Using filesort +1 PRIMARY t4 NULL ref c c 5 test.t2.c 2 100.00 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 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 +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 t3 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL range a,c a 5 NULL 2 100.00 Using index condition; Using where +1 PRIMARY t4 NULL ref c c 5 test.t2.c 2 100.00 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 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 +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 t3 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL range a,c a 5 NULL 2 100.00 Using index condition; Using where +1 PRIMARY t4 NULL ref c c 5 test.t2.c 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ref uid uid 5 const 4 100.00 Using where; Start temporary +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t3.fid 1 100.00 Using index +1 PRIMARY t1 NULL ALL uid NULL NULL NULL 11 100.00 Using where; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.fid 1 100.00 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +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 t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +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 +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +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 +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type 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 12 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +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 temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL system NULL NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 SIMPLE c1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE c2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c4 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c5 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c6 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c7 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c8 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c9 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c10 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c11 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c12 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c13 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c14 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c15 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c16 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c17 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c18 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c19 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c20 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c21 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c22 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c23 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c24 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c25 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c26 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE c27 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 128 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 128 100.00 +2 MATERIALIZED t5 NULL hash_ALL NULL #hash#$hj 5 test.t4.e1 128 100.00 Using where; Using join buffer (flat, BNLH join) +2 MATERIALIZED t2 NULL hash_ALL NULL #hash#$hj 5 test.t4.e1 128 100.00 Using where; Using join buffer (incremental, BNLH join) SELECT * FROM t1 WHERE i1 < 10 AND @@ -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 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 +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) +2 UNCACHEABLE SUBQUERY t3 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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) +2 UNCACHEABLE SUBQUERY t3 NULL system NULL NULL NULL NULL 1 100.00 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 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) +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) set join_buffer_space_limit=1024*8; explain select count(*) from t1, t1 t2 where t1.a=t2.a; -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) +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) 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE PROFILING NULL ALL NULL NULL NULL NULL NULL NULL Using where +1 SIMPLE db NULL hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 2 100.00 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 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) +id select_type 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 hash_index d #hash#d:d 5:5 test.t2.c 2 50.00 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 50.00 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 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) +id select_type 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 hash_index d #hash#d:d 5:5 test.t2.c 2 50.00 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 50.00 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 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 +id select_type 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 eq_ref PRIMARY PRIMARY 12 test.t1.c,test.t1.a,test.t1.b 1 100.00 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 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) +id select_type 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 hash_index PRIMARY #hash#PRIMARY:PRIMARY 12:12 test.t1.c,test.t1.a,test.t1.b 2 50.00 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_nested.result b/mysql-test/main/join_nested.result index 77f39bbe3f2..692bcc5d602 100644 --- a/mysql-test/main/join_nested.result +++ b/mysql-test/main/join_nested.result @@ -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 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 +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 index +1 SIMPLE t2 NULL range b b 5 NULL 3 100.00 Using where; Using index +1 SIMPLE t3 NULL ref c c 5 test.t2.b 2 50.00 Using index EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; -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 +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 index +1 SIMPLE t2 NULL range b b 5 NULL 3 100.00 Using where; Using index +1 SIMPLE t3 NULL ref c c 5 test.t2.b 2 50.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const c NULL NULL NULL 1 100.00 Impossible ON condition +1 SIMPLE t2 NULL const b NULL NULL NULL 1 100.00 Impossible ON condition +1 SIMPLE t1 NULL index NULL a 5 NULL 21 100.00 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 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 +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 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 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 +id select_type 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 0 0.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 0 0.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X 100.00 +1 SIMPLE t3 NULL ref a a 5 test.t2.b X 100.00 Using where +1 SIMPLE t5 NULL ref a a 5 test.t3.b X 100.00 +1 SIMPLE t4 NULL ref a a 5 test.t3.b X 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X 100.00 +1 SIMPLE t3 NULL ref a a 5 test.t2.b X 100.00 Using index condition +1 SIMPLE t4 NULL ref a a 5 test.t3.b X 100.00 Using where +1 SIMPLE t6 NULL ref a a 5 test.t4.b X 100.00 +1 SIMPLE t5 NULL ref a a 5 test.t2.b X 100.00 Using where +1 SIMPLE t7 NULL ref a a 5 test.t5.b X 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X 100.00 +1 SIMPLE t3 NULL ref a a 5 test.t2.b X 100.00 Using where +1 SIMPLE t5 NULL ref a a 5 test.t3.b X 100.00 +1 SIMPLE t4 NULL ref a a 5 test.t5.a X 100.00 Using where +1 SIMPLE t6 NULL ref a a 5 test.t4.b X 100.00 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 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 +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 ref a a 5 test.t1.a 1 100.00 Using where +1 SIMPLE t3 NULL ref a a 5 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index package_id package_id 5 NULL 45 100.00 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.package_id 1 100.00 +1 SIMPLE t4 NULL eq_ref PRIMARY,id PRIMARY 2 test.t1.carrier 1 100.00 Using where +1 SIMPLE t5 NULL ref carrier_id carrier_id 5 test.t4.id 22 100.00 Using index +1 SIMPLE t3 NULL ref package_id package_id 5 test.t2.package_id 1 100.00 Using index SELECT COUNT(*) FROM ((t2 JOIN t1 ON t2.package_id = t1.id) JOIN t3 ON t3.package_id = t1.id) diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result index e03d266d2e7..3ff50965e19 100644 --- a/mysql-test/main/join_nested_jcl6.result +++ b/mysql-test/main/join_nested_jcl6.result @@ -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 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 +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 index +1 SIMPLE t2 NULL range b b 5 NULL 3 100.00 Using where; Using index +1 SIMPLE t3 NULL ref c c 5 test.t2.b 2 50.00 Using index EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c; -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 +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 index +1 SIMPLE t2 NULL range b b 5 NULL 3 100.00 Using where; Using index +1 SIMPLE t3 NULL ref c c 5 test.t2.b 2 50.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const c NULL NULL NULL 1 100.00 Impossible ON condition +1 SIMPLE t2 NULL const b NULL NULL NULL 1 100.00 Impossible ON condition +1 SIMPLE t1 NULL index NULL a 5 NULL 21 100.00 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 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 +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 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 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) +id select_type 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.c11 0 0.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t3 NULL hash_ALL NULL #hash#$hj 5 test.t1.c11 0 0.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X 100.00 +1 SIMPLE t3 NULL ref a a 5 test.t2.b X 100.00 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 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL ref a a 5 test.t3.b X 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X 100.00 +1 SIMPLE t3 NULL ref a a 5 test.t2.b X 100.00 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 100.00 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 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL ref a a 5 test.t2.b X 100.00 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL X 100.00 +1 SIMPLE t3 NULL ref a a 5 test.t2.b X 100.00 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 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t4 NULL ref a a 5 test.t5.a X 100.00 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 100.00 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 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 +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 ref a a 5 test.t1.a 1 100.00 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index package_id package_id 5 NULL 45 100.00 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.package_id 1 100.00 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 100.00 Using where +1 SIMPLE t5 NULL ref carrier_id carrier_id 5 test.t4.id 22 100.00 Using index +1 SIMPLE t3 NULL ref package_id package_id 5 test.t2.package_id 1 100.00 Using index SELECT COUNT(*) FROM ((t2 JOIN t1 ON t2.package_id = t1.id) JOIN t3 ON t3.package_id = t1.id) @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 3 100.00 +1 SIMPLE t7 NULL ref|filter PRIMARY,b_i b_i|PRIMARY 5|4 test.t5.b 2 (29%) 28.57 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%) 85.71 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 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t8 NULL ALL b_i NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t7 NULL ref b_i b_i 5 const 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t8 NULL ALL b_i NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t8 NULL ALL b_i NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t7 NULL const PRIMARY PRIMARY 4 const 1 100.00 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 881c2083b12..60afe062c6a 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE g NULL ref groups_dt groups_dt 70 const,test.a.type 13 100.00 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 5e7ee8b3359..78a764c14f3 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 partitions type possible_keys key key_len ref rows 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 explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=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 -1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 8 test.t1.a 1 Using where +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 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 8 test.t1.a 1 100.00 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 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 +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; 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 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 +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 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 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 +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; 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 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 +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 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 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 +id select_type 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 ref id id 4 test.t1.id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 3 100.00 Using index +1 SIMPLE t1 NULL const PRIMARY PRIMARY 2 const 1 100.00 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 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 +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 2 100.00 Using where +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 100.00 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL system PRIMARY 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 10 const,const,const 1 100.00 +1 SIMPLE t2 NULL const PRIMARY,id PRIMARY 14 const,const,const,const 1 100.00 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 3 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 100.00 +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a WHERE t1.a IN(t2.a, t2.b); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 100.00 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 100.00 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 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 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 +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 ref idx idx 4 test.t1.id 2 100.00 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 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 +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 index NULL PRIMARY 4 NULL 3 100.00 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 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 +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 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 5 100.00 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; @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tt1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE tt2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE tt3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE tt4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE tt5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE tt6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE tt7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE tt8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE tt9 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE TA2 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 SIMPLE TA3 NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (flat, BNL join) +1 SIMPLE TA1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where DROP TABLE t1, t2; # # Bug#48971 Segfault in add_found_match_trig_cond () at sql_select.cc:5990 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 100.00 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 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 +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 col_int_unique col_int_unique 5 const 1 100.00 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; @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 100.00 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; @@ -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 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 +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 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 const PRIMARY PRIMARY 4 const 1 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where SELECT t2.b FROM t1 LEFT JOIN t2 ON (t2.b) IN (SELECT c2 from t3) AND t2.a = 1; b @@ -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 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 +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 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using index explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo'; -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 +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 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 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 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 +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 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using index drop table t0, t1; # # MDEV-4836: Wrong result on <not null date column> IS NULL (old documented hack stopped working) @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref b b 5 const 780 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref b b 5 const 780 100.00 Using index condition explain select * from t2 force index (c) where c is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c c 5 const 393 100.00 Using index condition explain select * from t1 left join t2 on t2.b is null; -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 +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 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 1000 78.00 Using where explain select * from t1 left join t2 on t2.c is null; -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 +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 +1 SIMPLE t2 NULL ALL c NULL NULL NULL 1000 39.30 Using where drop table t1,t2; # # MDEV-10006: optimizer doesn't convert outer join to inner on views with WHERE clause @@ -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 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 +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 range a a 5 NULL 5 100.00 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 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 +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 range a a 5 NULL 5 100.00 Using where # # .. part 2: make sure condition selectivity can use the condition too. # diff --git a/mysql-test/main/join_outer_innodb.result b/mysql-test/main/join_outer_innodb.result index 8faaec2f3db..0934682a992 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,name name 23 NULL 2 100.00 Using where; Using index +1 SIMPLE t2 NULL ref fkey fkey 5 test.t1.id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,name name 23 NULL 2 100.00 Using where; Using index +1 SIMPLE t2 NULL ref fkey fkey 5 test.t1.id 1 100.00 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 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 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6a NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t6b NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6a NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t6b NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a4,a6,a5,a7 NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 100.00 Using where; Using index +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 100.00 Using where +1 SIMPLE t6 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 100.00 Using where; Using index +1 SIMPLE t8 NULL eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 100.00 +1 SIMPLE t9 NULL ref PRIMARY PRIMARY 1 test.t1.a4 1 100.00 +1 SIMPLE t11 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 100.00 +1 SIMPLE t12 NULL eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 100.00 Using where +1 SIMPLE l2 NULL eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 100.00 Using where +1 SIMPLE t13 NULL ref PRIMARY,m3 m3 8 const,test.t1.a1 1 100.00 Using index +1 SIMPLE l4 NULL eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 100.00 Using where; Using index +1 SIMPLE m2 NULL ref PRIMARY,m3 m3 8 const,test.t1.a1 1 100.00 Using index +1 SIMPLE l3 NULL eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 100.00 Using where +1 SIMPLE t14 NULL eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 100.00 Using where +1 SIMPLE t15 NULL eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 100.00 Using where; Using index +1 SIMPLE t16 NULL ref PRIMARY PRIMARY 2 test.t15.o1 1 100.00 Using where +1 SIMPLE t10 NULL ALL PRIMARY NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) explain select * from v1; -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a4,a6,a5,a7 NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a1 1 100.00 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 100.00 Using where; Using index +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 100.00 Using index +1 SIMPLE t5 NULL eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 100.00 Using where +1 SIMPLE t6 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 100.00 Using where; Using index +1 SIMPLE t8 NULL eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 100.00 Using index +1 SIMPLE t7 NULL eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 100.00 +1 SIMPLE t9 NULL ref PRIMARY PRIMARY 1 test.t1.a4 1 100.00 +1 SIMPLE t11 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 100.00 +1 SIMPLE t12 NULL eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 100.00 Using where +1 SIMPLE l2 NULL eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 100.00 Using where +1 SIMPLE t13 NULL ref PRIMARY,m3 m3 8 const,test.t1.a1 1 100.00 Using index +1 SIMPLE l4 NULL eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 100.00 Using where; Using index +1 SIMPLE m2 NULL ref PRIMARY,m3 m3 8 const,test.t1.a1 1 100.00 Using index +1 SIMPLE l3 NULL eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 100.00 Using where +1 SIMPLE t14 NULL eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 100.00 Using where +1 SIMPLE t15 NULL eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 100.00 Using where; Using index +1 SIMPLE t16 NULL ref PRIMARY PRIMARY 2 test.t15.o1 1 100.00 Using where +1 SIMPLE t10 NULL ALL PRIMARY NULL NULL NULL 3 100.00 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 6e88bb8932a..c31443a3d47 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 partitions type possible_keys key key_len ref rows 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 explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=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 -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 +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 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 8 test.t1.a 1 100.00 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 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) +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 2 test.t1.id 3 100.00 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 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) +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 2 test.t1.id 3 100.00 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 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) +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 2 test.t1.id 3 100.00 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 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) +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 2 test.t1.id 3 100.00 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 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 +id select_type 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 ref id id 4 test.t1.id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 3 100.00 Using index +1 SIMPLE t1 NULL const PRIMARY PRIMARY 2 const 1 100.00 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 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) +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 4 test.t1.a1 2 100.00 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t3 NULL hash_ALL NULL #hash#$hj 5 test.t1.a1 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE s NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary; Using filesort +1 SIMPLE m NULL const match_id,match_id_2 match_id 1 const 1 100.00 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL system PRIMARY 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 10 const,const,const 1 100.00 +1 SIMPLE t2 NULL const PRIMARY,id PRIMARY 14 const,const,const,const 1 100.00 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 3 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 100.00 +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 100.00 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 4 100.00 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 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 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 +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 ref idx idx 4 test.t1.id 2 100.00 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 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 +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 index NULL PRIMARY 4 NULL 3 100.00 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 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 +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 Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 5 100.00 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; @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tt1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE tt2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE tt3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE tt9 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE TA2 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 SIMPLE TA3 NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (flat, BNL join) +1 SIMPLE TA1 NULL ALL NULL NULL NULL NULL 2 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 100.00 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 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 +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 col_int_unique col_int_unique 5 const 1 100.00 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; @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 const 1 100.00 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; @@ -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 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 +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 eq_ref PRIMARY PRIMARY 4 const 1 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 const PRIMARY PRIMARY 4 const 1 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where SELECT t2.b FROM t1 LEFT JOIN t2 ON (t2.b) IN (SELECT c2 from t3) AND t2.a = 1; b @@ -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 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 +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 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using index explain select * from t1 left join t0 on t0.a=t1.pk where t0.person_id='fooo'; -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 +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 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 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 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 +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 eq_ref PRIMARY PRIMARY 4 test.t0.a 1 100.00 Using index drop table t0, t1; # # MDEV-4836: Wrong result on <not null date column> IS NULL (old documented hack stopped working) @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref b b 5 const 780 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref b b 5 const 780 100.00 Using index condition explain select * from t2 force index (c) where c is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c c 5 const 393 100.00 Using index condition explain select * from t1 left join t2 on t2.b is null; -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) +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 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 1000 78.00 Using where; Using join buffer (flat, BNL join) explain select * from t1 left join t2 on t2.c is null; -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) +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 +1 SIMPLE t2 NULL ALL c NULL NULL NULL 1000 39.30 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 @@ -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 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) +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_range a #hash#$hj:a 5:5 test.t1.a 5 0.50 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 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) +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_range a #hash#$hj:a 5:5 test.t1.a 5 0.50 Using where; Rowid-ordered scan; Using join buffer (incremental, BNLH join) # # .. part 2: make sure condition selectivity can use the condition too. # diff --git a/mysql-test/main/key.result b/mysql-test/main/key.result index 5f34c5ec51b..d2f34791bcc 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 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 Using index explain select 1 from t1 where id =2 or id=3; -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 +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 explain select name from t1 where id =2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +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 ALTER TABLE t1 DROP PRIMARY KEY, ADD INDEX (id); explain select 1 from t1 where id =2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref id id 4 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const numreponse numreponse 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const numreponse numreponse 4 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 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 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 +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 range a a 5 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 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 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 6 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 5 NULL 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 SIMPLE t1 NULL eq_ref b b 10 test.t2.a,test.t2.b 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 SIMPLE t1 NULL eq_ref PRIMARY,b PRIMARY 8 test.t2.a,test.t2.b 1 100.00 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 06a9d1887fa..b35fb685761 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 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 2 100.00 Using index select p from t1; p 2 11 explain select i from t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL k1 5 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 SIMPLE t2 NULL ref k1 k1 5 test.t1.p 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 5 100.00 Using index select p from t2; p 2 @@ -168,8 +168,8 @@ p 2000 3000 explain select i from t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL k1 5 NULL 5 100.00 Using index select i from t2; i 2 @@ -178,8 +178,8 @@ i 3 3 explain select a from t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL k2 11 NULL 5 100.00 Using index select a from t2; a pppp @@ -228,8 +228,8 @@ p 2000 4000 explain select i from t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL k1 5 NULL 5 100.00 Using index select i from t2; i 2 @@ -238,8 +238,8 @@ i 3 3 explain select a from t2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL k2 11 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 9 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 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index k1 k1 5 NULL 1024 100.00 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.i 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 8 Using where; Using index +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; 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index_merge k1,k2 k1,k2 5,11 NULL 50 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index_merge k1,k2 k1,k2 5,11 NULL 50 100.00 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 378ad4d25ee..611f369b6c8 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 5 100.00 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 5 100.00 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 097a6ae2d2c..72d5466dfd8 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 3 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 3 const 1 100.00 Using index describe select * from t1 where t1="ABCD"; -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 +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 drop table t1; diff --git a/mysql-test/main/limit.result b/mysql-test/main/limit.result index 7d728602e92..00d423757cd 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 7 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit +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 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 1c0214a5be4..c1345ee94da 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1i NULL index PRIMARY PRIMARY 2 NULL 4 100.00 Using index +1 SIMPLE t2i NULL eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 100.00 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 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) +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) 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1i NULL index PRIMARY PRIMARY 2 NULL 4 100.00 Using index +1 SIMPLE t2i NULL eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 100.00 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 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) +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 hash_ALL NULL #hash#$hj 3 test.t1.c1 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1i NULL index PRIMARY PRIMARY 2 NULL 4 100.00 Using index +1 SIMPLE t2i NULL eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 100.00 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 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 +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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL system NULL NULL NULL NULL 0 Const row not found +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL system NULL NULL NULL NULL 0 0.00 Const row not found explain select * from t0 LIMIT ROWS EXAMINED 1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL system NULL NULL NULL NULL 0 0.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL const PRIMARY PRIMARY 2 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL const PRIMARY PRIMARY 2 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL const PRIMARY PRIMARY 2 const 1 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 2 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 2 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 2 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL range PRIMARY PRIMARY 2 NULL 4 100.00 Using where; Using index +1 PRIMARY t2i NULL eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index NULL PRIMARY 2 NULL 4 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2i NULL unique_subquery PRIMARY PRIMARY 2 func 1 100.00 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 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 +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 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1i NULL index NULL PRIMARY 2 NULL 4 100.00 Using where; Using index +2 MATERIALIZED t2i NULL range PRIMARY PRIMARY 2 NULL 4 100.00 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 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 +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 2 func 1 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3i NULL index NULL it3j 8 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 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 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 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 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 100.00 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 partitions type possible_keys key key_len ref rows 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3_empty NULL system NULL NULL NULL NULL 0 0.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3i NULL index NULL it3j 8 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3i NULL index NULL it3j 8 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3i NULL index NULL it3j 8 NULL 5 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3i NULL index NULL it3j 8 NULL 5 100.00 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 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) +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 temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 3 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type 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 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 7 100.00 Using join buffer (flat, BNL join) +1 PRIMARY alias3 NULL index NULL c 5 NULL 7 100.00 Using where; Using index; Using join buffer (incremental, BNL join) +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 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 diff --git a/mysql-test/main/long_unique.result b/mysql-test/main/long_unique.result index 9e55899c1e1..0639ad8815d 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY,f,f2 PRIMARY 4 NULL 1 100.00 Using index condition +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 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/mdev13607.result b/mysql-test/main/mdev13607.result index e1edb68c1cd..cd4fbcd7f0d 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY r1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived4> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived5> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived6> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived7> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived8> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived9> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived10> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived11> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived12> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived13> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived14> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived15> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived16> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY <derived17> NULL ALL NULL NULL NULL NULL 18446744073709551615 100.00 Using join buffer (incremental, BNL join) +17 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +17 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +17 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +17 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +16 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +16 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +16 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +15 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +15 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +15 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +14 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +14 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +14 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +13 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +13 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +13 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +12 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +12 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +12 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +11 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +11 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +11 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +10 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +10 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +10 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +9 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +9 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +9 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +8 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +8 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +8 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +7 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +7 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +7 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +6 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +6 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +6 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +5 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +5 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +5 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +4 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +4 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +4 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED d1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 DERIVED r2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d5 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d6 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d7 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED r8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED d8 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p1 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p2 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p3 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p4 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p5 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p6 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p7 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p8 NULL ALL NULL NULL NULL NULL 50 100.00 Using where; Using join buffer (incremental, BNL join) +3 DERIVED p9 NULL ALL NULL NULL NULL NULL 50 100.00 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 3beb48f6e09..4bbaad20936 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range a a 4 NULL 17 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range a a 4 NULL 17 100.00 Using where explain select * from t3 where a > 10 and a < 20; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range a a 4 NULL 17 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL index NULL a 4 NULL 10 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index NULL a 4 NULL 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY PRIMARY 35 NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY PRIMARY 35 NULL 6 60.00 Using where EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY,files PRIMARY 35 NULL 6 60.00 Using where EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,files PRIMARY 35 NULL 6 60.00 Using index condition EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code = '0000000115' LIMIT 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY,files PRIMARY 35 const,const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ref a a 5 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ref a a 5 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ref a a 5 const 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ref a a 5 const 4 100.00 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 partitions type possible_keys key key_len ref rows 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 EXPLAIN SELECT COUNT(*) FROM t4; -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 +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 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 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 +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 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 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) +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 t5 NULL index_merge a,b a,b 5,5 NULL 6 100.00 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 071e1af9249..5def7906c19 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref level level 1 const # Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref level level 1 const # 100.00 Using index explain select level,id from t1 where level=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref level level 1 const # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref level level 1 const # 100.00 explain select level,id,parent_id from t1 where level=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref level level 1 const # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref level level 1 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref level level 1 const # Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref level level 1 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # 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 # 100.00 Using filesort explain select * from t1 order by b; -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 +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.00 Using filesort explain select * from t1 order by c; -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 +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.00 Using filesort explain select a from t1 order by a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL # 100.00 Using index explain select b from t1 order by b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 4 NULL # 100.00 Using index explain select a,b from t1 order by b; -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 +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.00 Using filesort explain select a,b from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # +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.00 explain select a,b,c from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # +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.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range c c 5 NULL # Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c c 5 NULL # 100.00 Using index condition update t1 set c=a; explain select * from t1 where c between 1 and 2500; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c c 5 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 2 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 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where; Using index explain select count(*) from t1 where c='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c c 11 const # 100.00 Using where; Using index explain select count(*) from t1 where t='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref t t 13 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 13 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v,v_2 # 13 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v,v_2 # 13 const # # Using index condition 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 303 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # # Using index condition 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 33 NULL # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 33 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # # Using where 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref ba ba 20 const,const 1 100.00 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 89c647faf0e..fb7097223f2 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL const PRIMARY PRIMARY 12 const 1 100.00 Using index +1 PRIMARY <derived2> NULL ref key0 key0 13 const 0 0.00 Using where; Using filesort +2 DERIVED t4 NULL ALL NULL NULL NULL NULL 1 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (flat, BNL join) +2 DERIVED t3 NULL ALL NULL NULL NULL NULL 1 100.00 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 6026c7699ae..bd1f8a80bfe 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref s1 s1 11 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref s1 s1 11 const 1 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref s2 s2 11 const 1 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE s1='a' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref s1 s1 11 const 1 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE s2='a' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE s1 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 2 100.00 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 2 100.00 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range s1 s1 11 NULL 1 100.00 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL s2 NULL NULL NULL 10 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null b b 5 const 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null b b 5 const 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range FieldKey FieldKey 38 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range StringField StringField 38 NULL 3 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range StringField StringField 38 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 4 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,key1 PRIMARY 8 NULL 7 0.30 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,f4 f4 35 NULL 5 38.46 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where; Using index explain select count(*) from t1 where c='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c c 11 const # 100.00 Using where; Using index explain select count(*) from t1 where t='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref t t 13 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 13 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v,v_2 # 13 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v,v_2 # 13 const # # Using index condition 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 303 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # # Using index condition 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 33 NULL # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 33 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # # Using where 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref ba ba 20 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country Population 4 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country Country,Population 3,4 NULL # 1.88 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL # 7.50 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country # # NULL # 1.67 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country # # NULL # 1.33 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/multi_update.result b/mysql-test/main/multi_update.result index 1e494829a0b..0901fda3ba2 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 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 +id select_type 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using temporary; Using filesort +1 PRIMARY t1 NULL ref a a 5 test.t2.a 1 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type 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 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 2 100.00 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 39d4ab7da64..0ae737fc768 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 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 filesort explain select * from t1 order by b; -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 +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 filesort explain select * from t1 order by c; -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 +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 filesort explain select a from t1 order by a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index explain select b from t1 order by b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 4 NULL 4 100.00 Using index explain select a,b from t1 order by b; -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 +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 filesort explain select a,b from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain select a,b,c from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 100.00 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 5 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 100.00 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 100.00 +1 SIMPLE t1 NULL ref a a 4 test.t2.a 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL b NULL NULL NULL 2 100.00 Using where +1 SIMPLE t1 NULL ref b b 5 test.t2.b 1 100.00 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 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) +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 a NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) explain select * from t1 where a=0 or a=2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 5 100.00 Using where explain select * from t1 force index (a) where a=0 or a=2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 4 NULL 5 100.00 Using index condition explain select * from t1 where c=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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c,c_2 c 5 const 1 100.00 explain select * from t1 use index() where c=1; -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 +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 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 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 +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 Using temporary +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index explain select distinct t1.a from t1,t2 order by t2.a; -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 +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 Using temporary +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx idx 4 const 2 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where; Using index explain select count(*) from t1 where c='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c c 11 const # 100.00 Using where; Using index explain select count(*) from t1 where t='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref t t 13 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 13 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v,v_2 # 13 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v,v_2 # 13 const # # Using index condition 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 303 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # # Using index condition 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 33 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 33 NULL # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 33 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # # Using where 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref ba ba 20 const,const 1 100.00 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 872c9676bc7..bcc07974643 100644 --- a/mysql-test/main/myisam_explain_non_select_all.result +++ b/mysql-test/main/myisam_explain_non_select_all.result @@ -10,8 +10,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a < 10; @@ -53,8 +53,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a < 10; @@ -96,8 +96,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE a = 1; @@ -141,9 +141,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1, t2 SET t1.a = 10 WHERE t1.a = 1; @@ -189,10 +189,10 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 t11, (SELECT * FROM t2) t12 SET t11.a = 10 WHERE t11.a = 1; @@ -239,9 +239,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3); @@ -289,9 +289,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT b FROM t2 WHERE t1.a < 3); @@ -340,11 +340,11 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1, t2 SET a = 10 WHERE a IN (SELECT b FROM t2 WHERE t2.b < 3); @@ -394,10 +394,10 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 t11, (SELECT * FROM t2) t12 SET t11.a = t11.a + 10; @@ -446,10 +446,10 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 t11, (SELECT 1 FROM DUAL) t12 SET t11.a = t11.a + 10; @@ -500,10 +500,10 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 t11, (SELECT * FROM t2) t12 SET t11.a = 10 WHERE t11.a > 1; @@ -548,8 +548,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a > 1 LIMIT 1; @@ -591,8 +591,8 @@ 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 partitions type possible_keys key key_len ref rows 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE 0; @@ -631,8 +631,8 @@ 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 partitions type possible_keys key key_len ref rows 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 USING t1 WHERE 0; @@ -671,8 +671,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 1 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a = 3; @@ -712,8 +712,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 1 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a < 3; @@ -751,8 +751,8 @@ 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 partitions type possible_keys key key_len ref rows 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; @@ -790,8 +790,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; @@ -833,8 +833,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1; @@ -877,8 +877,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 ORDER BY a ASC, b ASC LIMIT 1; @@ -930,10 +930,10 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE t1,t2,t3 FROM t1,t2,t3 WHERE a1=a2 AND b2=a3 AND b1=b3; @@ -984,9 +984,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2); @@ -1034,9 +1034,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); @@ -1079,9 +1079,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); @@ -1125,8 +1125,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET i = 10; @@ -1168,8 +1168,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 5 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1; @@ -1214,8 +1214,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 15 NULL 5 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1260,8 +1260,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO t2 SELECT * FROM t1; @@ -1304,8 +1304,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED REPLACE INTO t2 SELECT * FROM t1; @@ -1344,8 +1344,8 @@ CREATE TABLE t1 (i INT); # select: # EXPLAIN INSERT INTO t1 SET i = 10; -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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO t1 SET i = 10; @@ -1367,8 +1367,8 @@ CREATE TABLE t1 (i INT); # select: # EXPLAIN REPLACE INTO t1 SET i = 10; -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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED REPLACE INTO t1 SET i = 10; @@ -1395,8 +1395,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 5 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; @@ -1440,8 +1440,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; @@ -1493,8 +1493,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1547,8 +1547,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 15 NULL 5 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1596,8 +1596,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1650,8 +1650,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1705,8 +1705,8 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; @@ -1758,8 +1758,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 5 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; @@ -1805,8 +1805,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 ORDER BY a, b DESC LIMIT 5; @@ -1859,8 +1859,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 6 NULL 5 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t2 ORDER BY a DESC, b DESC LIMIT 5; @@ -1908,8 +1908,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 5 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; @@ -1956,8 +1956,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; @@ -2010,8 +2010,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -2065,8 +2065,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 15 NULL 5 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -2115,8 +2115,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -2169,8 +2169,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET d = 10 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -2224,8 +2224,8 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET i = 123 WHERE key1 < 13 or key2 < 14 ORDER BY key1; @@ -2277,8 +2277,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 5 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; @@ -2325,8 +2325,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 26 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET c = 10 ORDER BY a, b DESC LIMIT 5; @@ -2380,8 +2380,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 6 NULL 5 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t2 SET c = 10 ORDER BY a DESC, b DESC LIMIT 5; @@ -2432,8 +2432,8 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET c2 = 0 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; @@ -2478,8 +2478,8 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; @@ -2527,8 +2527,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a=a+10 WHERE a > 34; @@ -2572,9 +2572,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10; @@ -2615,9 +2615,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 LEFT JOIN t2 ON t1.c1 = t2.c1 SET t2.c2 = 10 WHERE t1.c3 = 10; @@ -2665,9 +2665,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET t1.f2=(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1); @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where DROP TABLE t1; #56 CREATE TABLE t1 (a INT); @@ -2738,9 +2738,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE v1 SET a = 1 WHERE a > 0; @@ -2781,10 +2781,10 @@ 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 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 +id select_type 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1, v1 SET v1.a = 1 WHERE t1.a = v1.a; @@ -2834,8 +2834,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM v1 WHERE a < 4; @@ -2883,9 +2883,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE v1 FROM t2, v1 WHERE t2.x = v1.a; @@ -2934,9 +2934,9 @@ 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 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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED DELETE v1 FROM t2, v1 WHERE t2.x = v1.a; @@ -2980,8 +2980,8 @@ CREATE VIEW v1 (x) AS SELECT a FROM t1; # select: SELECT NULL # EXPLAIN INSERT INTO v1 VALUES (10); -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 +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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO v1 VALUES (10); @@ -3020,8 +3020,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED INSERT INTO v1 SELECT * FROM t1; @@ -3058,8 +3058,8 @@ DROP VIEW v1; #68 CREATE TABLE t1 (i INT); EXPLAIN INSERT DELAYED INTO t1 VALUES (1); -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 +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 DROP TABLE t1; #69 CREATE TABLE t1 (a INT); @@ -3073,10 +3073,10 @@ 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 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 +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 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); @@ -3124,11 +3124,11 @@ 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 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 +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 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); @@ -3177,12 +3177,12 @@ 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 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 +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 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); @@ -3247,9 +3247,9 @@ 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 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 +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; Using temporary; Using filesort +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 DROP TABLE t1,t2; #74 CREATE TABLE t1(a INT PRIMARY KEY); @@ -3262,8 +3262,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a=a+1 WHERE a>10; @@ -3299,8 +3299,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 1 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 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED UPDATE t1 SET a=a+1 WHERE a>10 ORDER BY a+20; @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 DROP PROCEDURE p15; CALL p14(); DROP PROCEDURE p14; CALL p13(); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL 0 NULL Deleting all rows DROP PROCEDURE p13; CALL p12(); DROP PROCEDURE p12; CALL p11(); -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 +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 DROP PROCEDURE p11; CALL p10(); DROP PROCEDURE p10; CALL p9(); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 0 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 0 100.00 DROP PROCEDURE p9; CALL p8(); DROP PROCEDURE p8; CALL p7(); -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 +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 DROP PROCEDURE p7; CALL p6(); DROP PROCEDURE p6; CALL p5(); -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 +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 DROP PROCEDURE p5; CALL p4(); DROP PROCEDURE p4; CALL p3(); -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 +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 DROP PROCEDURE p3; CALL p2(); DROP PROCEDURE p2; CALL p1(); -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 +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 DROP PROCEDURE p1; DROP TABLE t1, t2; # diff --git a/mysql-test/main/myisam_icp.result b/mysql-test/main/myisam_icp.result index dee8c97f2f8..dba40aa6369 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 4 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 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c1 c1 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c1 c1 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c1 c1 12 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c1 c1 12 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL c1 NULL NULL NULL 100 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL c1 NULL NULL NULL 100 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range|filter PRIMARY,k1 PRIMARY|k1 4|5 NULL 3 (50%) 50.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # 100.00 Using where +2 DEPENDENT SUBQUERY it NULL eq_ref PRIMARY PRIMARY 4 func # 100.00 Using index condition +2 DEPENDENT SUBQUERY t2 NULL index NULL PRIMARY 4 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 5 80.00 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 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) +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 index condition; Rowid-ordered scan +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 100.00 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 100.00 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 13 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 13 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL PRIMARY,c NULL NULL NULL 64 100.00 Using where +1 PRIMARY t2 NULL ref g g 5 test.t.c 18 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL index PRIMARY PRIMARY 4 NULL 64 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx1 idx1 10 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1 idx1 10 NULL 2 100.00 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 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 +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; 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 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 +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 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 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) +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 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t4 NULL range b b 5 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 40 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 40 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 10 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 10 NULL 10 1.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 4 NULL 22 100.00 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 08f578fcd50..d558d52c326 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range kp1 kp1 5 NULL 11 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range kp1 kp1 5 NULL 11 100.00 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 cc8ddae6386..57e6a443940 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 10 1.79 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 20 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 19 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 20 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 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 20 100.00 Using where; Rowid-ordered scan set optimizer_switch='index_condition_pushdown=on'; explain select * from t1 where a < 20; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 5 100.00 +1 SIMPLE t1 NULL ref a a 5 test.t0.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE table2 NULL ALL col_varchar_key NULL NULL NULL 40 100.00 Using where +1 SIMPLE table3 NULL ref PRIMARY,col_varchar_key col_varchar_key 3 test.table2.col_varchar_key 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL f4 10 NULL 12 100.00 Using index +1 SIMPLE alias3 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE alias2 NULL ref f4 f4 5 test.alias3.f5 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 1380 100.00 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 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 +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 a a 5 test.t0.a 1 100.00 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 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 +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 a a 5 test.t0.a 1 100.00 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 fdd8a427230..e61460195db 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 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 select left(b,10), a from t1 order by a; left(b,10) a CCCCCCCCCC 3 diff --git a/mysql-test/main/negation_elimination.result b/mysql-test/main/negation_elimination.result index ef1f6958022..45ecd8972d7 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 20 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 20 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 11 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 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 6 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 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 19 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 19 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 Using index select * from t1 where not(a != 1); a 1 explain select * from t1 where not(a < 10); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 10 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 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 11 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 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 9 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 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 20 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 20 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 11 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 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 11 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 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 11 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 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 5 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 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 21 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 12 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 12 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 12 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 12 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 11 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 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 6 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 6 100.00 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 partitions type possible_keys key key_len ref rows 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 select * from t1 where not(NULL or a); a explain select * from t1 where not(NULL and a); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 10 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 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 15 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 15 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 11 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 11 100.00 Using where; Using index select * from t1 where ((a between 5 and 15) and (not(a like 10))); a 5 diff --git a/mysql-test/main/null.result b/mysql-test/main/null.result index e0baedf57f4..b8cb164618a 100644 --- a/mysql-test/main/null.result +++ b/mysql-test/main/null.result @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 4 NULL 2 100.00 Using index condition explain select * from t1 where a between 2 and 3 or b is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null i i 5 const 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref i i 4 const 8 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i i 4 const 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 SELECT * FROM t1 WHERE NOT (concat( dt, '1' ) IS NOT NULL); dt DROP TABLE t1; diff --git a/mysql-test/main/null_key.result b/mysql-test/main/null_key.result index c4c4d1fd6ac..ba03b0cee11 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 3 100.00 Using where; Using index explain select * from t1 where a is null and b = 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 9 const,const 1 100.00 Using where; Using index explain select * from t1 where a is null and b = 7; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 9 const,const 1 100.00 Using where; Using index explain select * from t1 where a=2 and b = 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const a,b a 9 const,const 1 100.00 Using index explain select * from t1 where a<=>b limit 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 9 NULL 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a,b a 9 NULL 2 100.00 Using where; Using index explain select * from t1 where (a is null or a = 7) and b=7; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null a,b a 9 const,const 2 16.67 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null a,b a 9 const,const 2 16.67 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a,b a 9 NULL 3 25.00 Using where; Using index explain select * from t1 where a > 1 and a < 3 limit 1; -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 +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; Using index explain select * from t1 where a > 8 and a < 9; -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 +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; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a,b a 5 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 100.00 Using where explain select * from t1 where a is null and b = 2 and c=0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 100.00 Using where explain select * from t1 where a is null and b = 7 and c=0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 100.00 Using where explain select * from t1 where a=2 and b = 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 5 const 1 100.00 Using where explain select * from t1 where a<=>b limit 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 12 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a,b a 5 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 5 100.00 Using where explain select * from t1 where (a is null or a = 7) and b=7 and c=0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null a,b a 5 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a,b a 5 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a,b a 5 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b a 5 const 3 100.00 Using where explain select * from t1 where a > 1 and a < 3 limit 1; -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 +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 explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 4 100.00 Using where explain select * from t1 where a > 8 and a < 9; -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 +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 explain select * from t1 where b like "6%"; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 12 NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null a,b a 10 const,const 2 13.33 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null a,b a 5 const 5 26.67 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null a a 5 const 5 100.00 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 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 +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 t1 NULL ref a,b a 10 test.t2.a,const 2 100.00 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 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 +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 t1 NULL ref a a 10 test.t2.a,const 2 100.00 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 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 +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 t1 NULL ref_or_null a a 10 test.t2.a,const 5 100.00 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 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 +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 ref_or_null a a 10 test.t2.a,const 5 100.00 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 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 +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 ref_or_null a a 5 test.t2.a 5 100.00 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 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 +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 +1 SIMPLE t1 NULL ref_or_null a a 5 test.t2.a 4 100.00 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 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 +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 +1 SIMPLE t1 NULL ref_or_null a a 5 test.t2.a 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL idx1 NULL NULL NULL 15 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx1 NULL NULL NULL 15 40.00 Using where explain select id from t1 where uniq_id =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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const idx1 idx1 5 const 1 100.00 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 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 +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 ref idx idx 5 test.t1.a 1 100.00 Using where +1 SIMPLE t3 NULL ref idx idx 5 test.t2.b 1 100.00 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 a57822548c3..a03d25b6d3e 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 partitions type possible_keys key key_len ref rows 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 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 7bf9c1a738f..d734c23f245 100644 --- a/mysql-test/main/olap.result +++ b/mysql-test/main/olap.result @@ -686,8 +686,8 @@ B C NULL EXPLAIN SELECT type FROM v1 GROUP BY type WITH ROLLUP; -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 +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 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 34b21951548..3c32da3b726 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 10 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 100 100.00 Using where +1 SIMPLE t2 NULL ref a a 5 test.t1.b 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 4 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 20 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL id 8 NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a_c,a_b a_c 5 NULL 180 11.67 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 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 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 +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 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 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 { @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref pk,pk_a,pk_a_b pk_a_b 15 const,const,const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL range a a 5 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL range a a 5 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL range a a 5 NULL 3 100.00 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 1 100.00 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 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 +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 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 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) +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 t_inner_1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 MATERIALIZED t_inner_2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t_outer_1 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY t_inner_1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t_inner_2 NULL ALL NULL NULL NULL NULL 9 100.00 End temporary; Using join buffer (incremental, BNL join) +1 PRIMARY t_inner_4 NULL ALL NULL NULL NULL NULL 3 100.00 Start temporary; Using join buffer (incremental, BNL join) +1 PRIMARY t_outer_2 NULL ALL NULL NULL NULL NULL 9 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY t_inner_3 NULL ALL NULL NULL NULL NULL 9 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t_outer_1 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 t_outer_2 NULL ALL NULL NULL NULL NULL 9 100.00 Using join buffer (flat, BNL join) +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t_inner_1 NULL ALL NULL NULL NULL NULL 3 100.00 +2 MATERIALIZED t_inner_2 NULL ALL NULL NULL NULL NULL 9 100.00 Using join buffer (flat, BNL join) +3 MATERIALIZED t_inner_4 NULL ALL NULL NULL NULL NULL 3 100.00 +3 MATERIALIZED t_inner_3 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a_b a_b 10 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a_b a_b 10 NULL 107 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range start_date start_date 8 NULL 1000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a_b_c a_b_c 8 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i_b i_b 17 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i_b i_b 17 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i_b i_b 13 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i_b i_b 11 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i_b i_b 13 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i_b i_b 11 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref i_b i_b 1003 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i_b i_b 1003 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i_b i_b 13 const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 10 50.00 Using where +1 SIMPLE B NULL ALL NULL NULL NULL NULL 1000 80.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 SIMPLE B NULL ref b b 5 test.A.a 1 80.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 258 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 258 const 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 5 100.00 +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 10 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL ref a a 5 test.t1.a 1 100.00 select JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) from INFORMATION_SCHEMA.OPTIMIZER_TRACE; JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans')) [ @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY NULL NULL NULL 1 100.00 Impossible ON condition +1 SIMPLE t2 NULL const PRIMARY NULL NULL NULL 1 100.00 Impossible ON condition +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY <derived3> NULL ref key0 key0 4 test.t0.a 2 100.00 FirstMatch(t0) +3 DERIVED NULL 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 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 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 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 10 100.00 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 8 test.t3.a,test.t2.b 1 100.00 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 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 +id select_type 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 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 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) +id select_type 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 4 100.00 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 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) +id select_type 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 4 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 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 9b851dce97c..30c3239422a 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3 key1,key2,key3 5,5,5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2,key3,key4 key1,key2,key3,key4 5,5,5,5 NULL 154 100.00 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 b13db022a59..7511ab81551 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref PRIMARY,key1 key1 4 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY,key1 key1 4 const 1 100.00 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 2c72c1f59c8..05ce38b0fdc 100644 --- a/mysql-test/main/opt_tvc.result +++ b/mysql-test/main/opt_tvc.result @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using where +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 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 ec4463b3f6e..2cf63a66ad4 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 22 NULL 3 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 22 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 4 NULL 22 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 22 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 4 const 12 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 4 const 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 9 const,const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 9 NULL 18 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 9 NULL 18 100.00 Using where; Using index explain select * from t1 where a = 2 and b >0 order by a desc,b desc; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 9 NULL 10 45.45 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 9 const,const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 9 NULL 11 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 9 NULL 11 50.00 Using where; Using index explain select * from t1 where a = 2 and b > 0 order by a desc,b desc; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 9 NULL 10 45.45 Using where; Using index explain select * from t1 where a = 2 and b < 2 order by a desc,b desc; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 9 NULL 4 18.18 Using where; Using index explain select * from t1 where a = 1 order by b desc; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 4 const 12 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 9 NULL 10 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 9 NULL 10 45.45 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 9 NULL 4 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 9 NULL 4 18.18 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 20 NULL 22 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 20 NULL 22 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 20 NULL 22 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 20 NULL 22 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 20 NULL 5 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 20 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 4 NULL 12 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 12 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 8 NULL 22 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 8 NULL 22 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 4 NULL 12 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 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY,uid NULL NULL NULL 6 100.00 Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 100.00 Using where; Using index +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.gid 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL PRIMARY NULL NULL NULL 6 100.00 Using temporary; Using filesort +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY,uid NULL NULL NULL 6 100.00 Using temporary; Using filesort +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.gid 1 100.00 Using index +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL PRIMARY NULL NULL NULL 6 100.00 Using temporary; Using filesort +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 100.00 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 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 +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 temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 2 test.t1.skr 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1000 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 1000 100.00 Using filesort explain select id,t from t1 force index (primary) order by id; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1000 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1000 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref FieldKey,LongField,StringField LongField 38 const 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref FieldKey,LongField,StringField LongField 38 const 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range FieldKey FieldKey 38 NULL 3 100.00 Using index condition; Using filesort EXPLAIN SELECT * FROM t1 IGNORE INDEX (FieldKey, LongField) WHERE FieldKey > '2' ORDER BY LongVal; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range StringField StringField 38 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range FieldKey,LongField,StringField LongField 38 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range FieldKey,LongField,StringField LongField 38 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null b b 5 const 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null b b 5 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range wnid14,wnid wnid 13 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range wnid14,wnid wnid 13 NULL 4 100.00 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 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 +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 temporary; Using filesort +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY,b b 5 const 1 100.00 +1 SIMPLE t2 NULL ref a a 5 const 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index k2 k3 5 NULL 111 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index k2 k3 5 NULL 111 100.00 Using where EXPLAIN SELECT id,c3 FROM t2 WHERE c2=11 ORDER BY c3 LIMIT 4000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index k2 k3 5 NULL 22318 32.89 Using where EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 10 AND 12 ORDER BY c3 LIMIT 20; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index k2 k3 5 NULL 73 100.00 Using where EXPLAIN SELECT id,c3 FROM t2 WHERE c2 BETWEEN 20 AND 30 ORDER BY c3 LIMIT 4000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range k2 k2 5 NULL 386 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 128 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 128 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 128 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 128 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null a_c,a a_c 10 const,const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x x x ref_or_null a_c,a x x x x x 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a,b b 4 const 4 100.00 Using index condition; Using where; Using temporary; Using filesort +1 SIMPLE t2 NULL ref a,b,c a 40 test.t1.a,const 11 79.85 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a,b,c c 5 NULL 420 26.24 Using where +1 SIMPLE t1 NULL eq_ref a a 39 test.t2.a,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref id2_j_id1 id2_j_id1 4 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range b,b_2 b 4 NULL 226 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b,b_2 b 4 NULL 226 98.23 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b,b_2 b 4 NULL 226 98.23 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 100.00 Using index condition; Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 100.00 Using index condition; Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 100.00 Using index condition; Using temporary; Using filesort +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 8 NULL 10 100.00 Using index; Using temporary; Using filesort +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using where DROP TABLE t1, t2; # # Bug #707848: WHERE condition with OR + ORDER BY + field substitution @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 10 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 10 100.00 Using where; Using index SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC; a 1 10 1 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1 idx1 5 NULL 503 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1 idx1 5 NULL 503 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 8 100.00 Using index +1 SIMPLE t2 NULL ref i_a i_a 5 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index +1 SIMPLE t2 NULL ref i_a i_a 5 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 8 100.00 Using index +1 SIMPLE t2 NULL ref i_a i_a 5 test.t1.a 2 100.00 Using index DROP TABLE t1,t2; # # MDEV-4974 memory leak in 5.5.32-MariaDB-1~wheezy-log @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range key1 key1 5 NULL 2 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range id_234_date,id_23_date id_23_date 2 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range id_23_date,id_234_date id_23_date 2 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index a a 5 NULL 5 100.00 Using where +1 SIMPLE t3 NULL ref a a 5 test.t2.a 1 100.00 # # 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 partitions 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index a a 5 NULL 5 100.00 Using where +1 SIMPLE t3 NULL ref a a 5 test.t2.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 200 100.00 Using where; Using filesort +1 SIMPLE t3 NULL ref a a 5 test.t2.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 200 100.00 Using where; Using filesort +1 SIMPLE t3 NULL ref a a 5 test.t2.a 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL index NULL a 5 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index NULL a 5 NULL 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL index NULL a 5 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index NULL a 5 NULL 10 100.00 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 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 +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 PRIMARY b 5 NULL 1 100.00 Using where SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2; c 1 @@ -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 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 +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 filesort +2 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 (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 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 +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 Using filesort +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 +2 DEPENDENT SUBQUERY t2 NULL ref key1 key1 5 test.t1.a 10 100.00 Using index condition; Using where; Using filesort select (SELECT concat(id, '-', key1, '-', col1) FROM t2 @@ -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 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 +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 Using filesort +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 Using filesort +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 57 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 57 100.00 Using filesort explain select * from t1 force index(r) order by a desc,b limit 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL r 10 NULL 20 100.00 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.result b/mysql-test/main/order_by_innodb.result index 7faeefdf327..3f0e9b2135e 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL # 100.00 Using sort_union(key1,key2); Using where; Using filesort explain select * from t1 where key1<3 or key2<3; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a_c,a_b a_c 10 const,const 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a_c,a_b a_b 5 NULL 200 10.00 Using where explain select a,b,c from t1 where a=1 and c=2 order by b limit 2000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a_c,a_b a_b 5 NULL 200 10.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL # 100.00 Using index +1 PRIMARY t2 NULL eq_ref PRIMARY,id2 PRIMARY 4 func # 100.00 Using where +2 DEPENDENT SUBQUERY dd NULL range id2,for_latest_sort for_latest_sort 6 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 57 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 57 100.00 Using filesort explain select * from t1 force index(r) order by a desc,b limit 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL r 10 NULL 20 100.00 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_optimizer.result b/mysql-test/main/order_by_optimizer.result index 62ed3a51e12..c807b31a1b8 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1010 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 1010 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary +1 SIMPLE B NULL index NULL a 5 NULL 20 100.00 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 6424109862e..29ba2fe16ce 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 FLTRD 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY,ux_pk1_fd5 ux_pk1_fd5 13 NULL 138 FLTRD 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref key1 key1 55 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref key1 key1 55 const,const 1 100.00 Using where; Using index drop table t1, t2; SET GLOBAL innodb_stats_persistent=@save_stats_persistent; diff --git a/mysql-test/main/order_by_optimizer_innodb.test b/mysql-test/main/order_by_optimizer_innodb.test index 33f67e522ad..28d1aac5b5e 100644 --- a/mysql-test/main/order_by_optimizer_innodb.test +++ b/mysql-test/main/order_by_optimizer_innodb.test @@ -35,8 +35,10 @@ from select pk1, count(*) from t2 group by pk1; --echo # The following should use range(ux_pk1_fd5), two key parts (key_len=5+8=13) +--replace_column 11 FLTRD EXPLAIN SELECT * FROM t2 USE INDEX(ux_pk1_fd5) WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; --echo # This also must use range, not ref. key_len must be 13 +--replace_column 11 FLTRD EXPLAIN SELECT * FROM t2 WHERE pk1=9 AND fd5 < 500 ORDER BY fd5 DESC LIMIT 10; drop table t0,t1, t2; diff --git a/mysql-test/main/order_by_zerolength-4285.result b/mysql-test/main/order_by_zerolength-4285.result index 30d373cac7d..6d3dfffa538 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 100.00 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/partition.result b/mysql-test/main/partition.result index a1c526896e6..9e93ff58434 100644 --- a/mysql-test/main/partition.result +++ b/mysql-test/main/partition.result @@ -235,11 +235,11 @@ SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01'; a b 2007-07-30 17:35:48 p1 EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 100.00 ALTER TABLE t1 REORGANIZE PARTITION pmax INTO ( PARTITION p3 VALUES LESS THAN (1247688000), PARTITION pmax VALUES LESS THAN MAXVALUE); @@ -252,11 +252,11 @@ SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01'; a b 2007-07-30 17:35:48 p1 EXPLAIN PARTITIONS SELECT * FROM t1 where a between '2007-01-01' and '2007-08-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 where a = '2007-07-30 17:35:48'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 100.00 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -550,8 +550,8 @@ KEY `c1` (`c1`) INSERT INTO `t1` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20); INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20); EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range c1 c1 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c1 c1 5 NULL 4 100.00 Using where; Using index FLUSH STATUS; SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); c1 @@ -571,8 +571,8 @@ Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 a range c1 c1 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 a range c1 c1 5 NULL 4 100.00 Using where; Using index FLUSH STATUS; SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); c1 @@ -606,8 +606,8 @@ PARTITION b VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */; INSERT INTO `t1` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20); INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20); EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range c1 c1 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c1 c1 5 NULL 2 100.00 Using where; Using index FLUSH STATUS; SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5); c1 @@ -625,8 +625,8 @@ Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 a range c1 c1 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 a range c1 c1 5 NULL 2 100.00 Using where; Using index FLUSH STATUS; SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5); c1 @@ -644,8 +644,8 @@ Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range c1 c1 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c1 c1 5 NULL 2 100.00 Using where; Using index FLUSH STATUS; SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15); c1 @@ -663,8 +663,8 @@ Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 a range c1 c1 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 a range c1 c1 5 NULL 2 100.00 Using where; Using index FLUSH STATUS; SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15); c1 @@ -1585,8 +1585,8 @@ select * from t1 where f1 is null; f1 NULL explain partitions select * from t1 where f1 is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1 (f1 integer) partition by list(f1) (partition p1 values in (1), partition p2 values in (null)); @@ -1637,14 +1637,14 @@ f1 1 2 explain partitions select * from t1 where f1 < 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p3 ALL NULL NULL NULL NULL 2 100.00 Using where select * from t1 where f1 is null; f1 NULL explain partitions select * from t1 where f1 is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1 (f1 int) partition by list(f1 div 2) ( @@ -1659,14 +1659,14 @@ select * from t1 where f1 < 3; f1 2 explain partitions select * from t1 where f1 < 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2,p3,p4,p5 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2,p3,p4,p5 ALL NULL NULL NULL NULL 5 100.00 Using where select * from t1 where f1 is null; f1 NULL explain partitions select * from t1 where f1 is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1 (a int) partition by LIST(a) ( partition pn values in (NULL), @@ -1681,15 +1681,15 @@ NULL 0 1 explain partitions select * from t1 where a is null or a < 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pn,p0,p1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pn,p0,p1 ALL NULL NULL NULL NULL 3 100.00 Using where select * from t1 where a is null or a < 0 or a > 1; a NULL 2 explain partitions select * from t1 where a is null or a < 0 or a > 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 2 100.00 Using where drop table t1; CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20)) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2302,8 +2302,8 @@ PARTITION p2 VALUES LESS THAN (300), PARTITION p3 VALUES LESS THAN MAXVALUE); INSERT INTO t1 VALUES (10), (100), (200), (300), (400); EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a>=200; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 3 100.00 Using where DROP TABLE t1; CREATE TABLE t1 ( a INT, b INT, c INT, KEY bc(b, c) ) PARTITION BY KEY (a, b) PARTITIONS 3 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 range bc bc 10 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 range bc bc 10 NULL 8 100.00 Using where; Using index for group-by DROP TABLE t1; # # Bug #45807: crash accessing partitioned table and sql_mode @@ -2687,24 +2687,24 @@ id select_type table partitions type possible_keys key key_len ref rows filtered 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 +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 explain extended select * from t2 where part_key in (1,2); 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 +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 explain extended select * from t2 where b=5; 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 +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 explain extended select * from t2 partition(p0) where b=1; 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 @@ -2728,8 +2728,8 @@ id select_type table partitions type possible_keys key key_len ref rows filtered 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 +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 # filtered should be 100 explain extended select * from t2 where part_key in (1,2); id select_type table partitions type possible_keys key key_len ref rows filtered Extra @@ -2737,16 +2737,16 @@ id select_type table partitions type possible_keys key key_len ref rows filtered 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 +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 explain extended select * from t2 where b=5; 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 +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 explain extended select * from t2 partition(p0) where b=1; 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 diff --git a/mysql-test/main/partition_column.result b/mysql-test/main/partition_column.result index 041c485c1a8..25a49762f93 100644 --- a/mysql-test/main/partition_column.result +++ b/mysql-test/main/partition_column.result @@ -97,8 +97,8 @@ select hex(a) from t1 where a like 'A_'; hex(a) 00410000 explain partitions select hex(a) from t1 where a like 'A_'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 alter table t1 remove partitioning; select hex(a) from t1 where a like 'A_'; hex(a) @@ -273,8 +273,8 @@ select * from t1 where a is null; a NULL explain partitions select * from t1 where a is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where select * from t1 where a <= 1; a 1 @@ -291,8 +291,8 @@ select * from t1 where a is null; a NULL explain partitions select * from t1 where a is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where select * from t1 where a <= 1; a 1 @@ -491,8 +491,8 @@ t1 CREATE TABLE `t1` ( PARTITION `p1` VALUES LESS THAN (1,'B',1) ENGINE = MyISAM) insert into t1 values (1, 'A', 1); explain partitions select * from t1 where a = 1 AND b <= 'A' and c = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 system NULL NULL NULL NULL 1 100.00 select * from t1 where a = 1 AND b <= 'A' and c = 1; a b c 1 A 1 @@ -610,8 +610,8 @@ partition by range columns(b,a) partition p1 values less than (3,3), partition p2 values less than (9,5)); explain partitions select * from t1 where b < 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 100.00 Using where select * from t1 where b < 2; a b 0 1 @@ -620,8 +620,8 @@ a b 3 1 9 1 explain partitions select * from t1 where b < 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 7 100.00 Using where select * from t1 where b < 4; a b 0 1 @@ -646,8 +646,8 @@ alter table t1 reorganize partition p2 into (partition p21 values less than (4,7), partition p22 values less than (9,5)); explain partitions select * from t1 where b < 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p11,p12,p21 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p11,p12,p21 ALL NULL NULL NULL NULL 6 100.00 Using where select * from t1 where b < 4; a b 0 1 diff --git a/mysql-test/main/partition_column_prune.result b/mysql-test/main/partition_column_prune.result index 95b45f4dea5..0b8543f4501 100644 --- a/mysql-test/main/partition_column_prune.result +++ b/mysql-test/main/partition_column_prune.result @@ -4,8 +4,8 @@ partition by range columns(a,b,c) ( partition p0 values less than ('a','b','c')); insert into t1 values ('a', NULL, 'd'); explain partitions select * from t1 where a = 'a' AND c = 'd'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 select * from t1 where a = 'a' AND c = 'd'; a b c a NULL d @@ -33,11 +33,11 @@ partition p6 values less than (70) insert into t2 values (5),(15),(25),(35),(45),(55),(65); insert into t2 values (5),(15),(25),(35),(45),(55),(65); explain partitions select * from t1 where a > 35 and a < 45; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t2 where a > 35 and a < 45; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 4 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 4 100.00 Using where drop table t1, t2; create table t1 (a int not null, b int not null ) partition by range columns(a,b) ( @@ -55,12 +55,12 @@ insert into t1 values (2,5), (2,15), (2,25), (4,5), (4,15), (4,25), (6,5), (6,15), (6,25); insert into t1 select * from t1; explain partitions select * from t1 where a=2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p01,p02,p03,p11 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p01,p02,p03,p11 ALL NULL NULL NULL NULL 8 100.00 Using where explain partitions select * from t1 where a=4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p11,p12,p13,p21 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p11,p12,p13,p21 ALL NULL NULL NULL NULL 8 100.00 Using where explain partitions select * from t1 where a=2 and b < 22; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p01,p02,p03 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p01,p02,p03 ALL NULL NULL NULL NULL 6 100.00 Using where drop table t1; diff --git a/mysql-test/main/partition_datatype.result b/mysql-test/main/partition_datatype.result index 2e518c194f0..ddc5b6eb859 100644 --- a/mysql-test/main/partition_datatype.result +++ b/mysql-test/main/partition_datatype.result @@ -571,8 +571,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 23:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz; a tz @@ -581,8 +581,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-26 22:59:59' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSK ALL NULL NULL NULL NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSK ALL NULL NULL NULL NULL 2 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz; a tz @@ -598,8 +598,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-03-26 22:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz; a tz @@ -613,8 +613,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-03-26 23:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz; a tz @@ -630,8 +630,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 23:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1 ALL NULL NULL NULL NULL 18 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1 ALL NULL NULL NULL NULL 18 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz; a tz @@ -646,8 +646,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 22:59:59' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2 ALL NULL NULL NULL NULL 15 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2 ALL NULL NULL NULL NULL 15 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz; a tz @@ -663,8 +663,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 22:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 13 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 13 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz; a tz @@ -678,8 +678,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 23:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 7 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 7 100.00 Using where; Using filesort # Test end range changes DELETE FROM t2 WHERE a = 0; INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'UTC'); @@ -989,8 +989,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 03:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz; a tz @@ -999,8 +999,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-03-01 00:00:00' and '2011-03-27 01:59:59' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSK ALL NULL NULL NULL NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSK ALL NULL NULL NULL NULL 2 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz; a tz @@ -1016,8 +1016,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-03-26 01:59:59' and '2011-03-28 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz; a tz @@ -1033,8 +1033,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-03-26 03:00:00' and '2011-03-28 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSK,p-2011-MSD-1 ALL NULL NULL NULL NULL 11 100.00 Using where; Using filesort # Testing the leap from 02:59:59 to 02:00:00 SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz; @@ -1042,32 +1042,32 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz; a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 02:59:59' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz; a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 03:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz; a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-01 00:00:00' and '2011-10-29 01:59:59' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1 ALL NULL NULL NULL NULL 9 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz; a tz @@ -1089,8 +1089,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 02:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz; a tz @@ -1112,8 +1112,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 02:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz; a tz @@ -1135,8 +1135,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 03:00:00' and '2011-10-31 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 100.00 Using where; Using filesort SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz; a tz @@ -1158,8 +1158,8 @@ a tz EXPLAIN PARTITIONS SELECT * FROM t2 WHERE a BETWEEN '2011-10-29 01:59:59' and '2011-10-31 00:00:00' ORDER BY a, tz; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p-2011-MSD-1,p-2011-MSD-2,p-2012-MSK-1,p-2012-MSK-2 ALL NULL NULL NULL NULL 22 100.00 Using where; Using filesort # Test end range changes DELETE FROM t2 WHERE a = 0; INSERT IGNORE INTO t2 VALUES ('1970-01-01 00:00:00', 'Moscow'); diff --git a/mysql-test/main/partition_default.result b/mysql-test/main/partition_default.result index db3b714bbcc..58ad8a717de 100644 --- a/mysql-test/main/partition_default.result +++ b/mysql-test/main/partition_default.result @@ -229,18 +229,18 @@ a b 20 20 10 10 explain partitions select * from t1 where a=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a=5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 select * from t1 where a=10 or a=5; a b 5 5 10 10 explain partitions select * from t1 where a=10 or a=5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p0 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p0 ALL NULL NULL NULL NULL 2 100.00 Using where drop table t1; create table t1 (a int, b int) PARTITION BY LIST COLUMNS(a,b) @@ -270,14 +270,14 @@ select * from t1 where a=10 and b=10; a b 10 10 explain partitions select * from t1 where a=10 and b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 select * from t1 where a=10; a b 10 10 explain partitions select * from t1 where a=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 select * from t1 where a<=10; a b 10 10 @@ -294,15 +294,15 @@ select * from t1 where a=10 and b=10; a b 10 10 explain partitions select * from t1 where a=10 and b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 select * from t1 where a=10 and b=10 or a=20 and b=20; a b 20 20 10 10 explain partitions select * from t1 where a=10 and b=10 or a=20 and b=20; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p0 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p0 ALL NULL NULL NULL NULL 2 100.00 Using where drop table t1; create table t1 (a int, b int); insert into t1 values (10,10),(2,5),(0,0); @@ -335,11 +335,11 @@ a b 0 0 10 10 explain partitions select * from t1 where a=2 and b=5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a=10 and b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1 (a int, b int); insert into t1 values (10,10),(2,5),(0,0); @@ -377,14 +377,14 @@ p0 2 p1 0 p2 1 explain partitions select * from t1 where a>=2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p1,p0 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p1,p0 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t1 where a>=2 and a<=3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p0 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p0 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t1 where a=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where drop table t1; CREATE TABLE t1 (a DATE, KEY(a)) PARTITION BY LIST (TO_DAYS(a)) @@ -847,11 +847,11 @@ p0 1 p1 1 p2 1 explain partitions select * from t1 where a=2 and b=5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a=10 and b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 alter table t1 PARTITION BY LIST (a) ( @@ -881,11 +881,11 @@ p0 1 p1 1 p2 1 explain partitions select * from t1 where a=2 and b=5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a=10 and b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 alter table t1 PARTITION BY LIST (a) ( @@ -915,11 +915,11 @@ p0 1 p1 1 p2 1 explain partitions select * from t1 where a=2 and b=5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a=10 and b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 alter table t1 drop partition p2; show create table t1; Table Create Table @@ -992,11 +992,11 @@ p0 1 p1 1 p2 1 explain partitions select * from t1 where a=2 and b=5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a=10 and b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 alter table t1 PARTITION BY LIST COLUMNS(a,b) ( @@ -1026,11 +1026,11 @@ p0 1 p1 1 p2 1 explain partitions select * from t1 where a=2 and b=5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a=10 and b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 alter table t1 PARTITION BY LIST COLUMNS(a,b) ( @@ -1060,11 +1060,11 @@ p0 1 p1 1 p2 1 explain partitions select * from t1 where a=2 and b=5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a=10 and b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 alter table t1 drop partition p2; show create table t1; Table Create Table @@ -1154,23 +1154,23 @@ i j 10 1 explain partitions select * from t1 where i = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 system NULL NULL NULL NULL 1 100.00 select * from t1 where i = 10 and j=1; i j 10 1 explain partitions select * from t1 where i = 10 and j=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 insert into t1 values (10,10); select * from t1 where i = 10 and j=10; i j 10 10 explain partitions select * from t1 where i = 10 and j=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1 ( @@ -1195,8 +1195,8 @@ insert into t1 values explain partitions select * from t1 where a>=10 and (a <=10 and b <=30); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2,p3 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2,p3 ALL NULL NULL NULL NULL 3 100.00 Using where drop table t1; # # MDEV-10763: Wrong result - server does not return NULL values @@ -1213,8 +1213,8 @@ i NULL explain partitions select * from t1 where i is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 alter table t1 partition by list (i) ( partition p0 values in (NULL), partition p1 values in (1), @@ -1224,8 +1224,8 @@ i NULL explain partitions select * from t1 where i is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 drop table t1; # # MDEV-12395: DROP PARTITION does not work as expected when diff --git a/mysql-test/main/partition_disabled.result b/mysql-test/main/partition_disabled.result index c78552beb9d..76ed1ee94c5 100644 --- a/mysql-test/main/partition_disabled.result +++ b/mysql-test/main/partition_disabled.result @@ -88,8 +88,8 @@ ERROR 42S02: Unknown table 'test.t1' create table t1 (a varchar(10) charset latin1 collate latin1_bin); insert into t1 values (''),(' '),('a'),('a '),('a '); explain partitions select * from t1 where a='a ' OR a='a'; -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 +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 drop table t1; # # bug#11760213-52599: ALTER TABLE REMOVE PARTITIONING ON NON-PARTITIONED diff --git a/mysql-test/main/partition_explicit_prune.result b/mysql-test/main/partition_explicit_prune.result index 5b3049c146f..56bb2677cfc 100644 --- a/mysql-test/main/partition_explicit_prune.result +++ b/mysql-test/main/partition_explicit_prune.result @@ -453,12 +453,12 @@ HANDLER_TMP_WRITE 132 EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (pNonexistent); ERROR HY000: Unknown partition 'pNonexistent' in table 't1' EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0-9_subp2 index NULL b 71 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0-9_subp2 index NULL b 71 NULL 2 100.00 Using index FLUSH STATUS; EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp2,pNeg) AS TableAlias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE TableAlias pNeg_subp0,pNeg_subp1,p0-9_subp2 index NULL b 71 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE TableAlias pNeg_subp0,pNeg_subp1,p0-9_subp2 index NULL b 71 NULL 4 100.00 Using index SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE @@ -466,17 +466,17 @@ HANDLER_COMMIT 1 HANDLER_TMP_WRITE 24 # 8 locks (1 ha_partition + 3 ha_innobase) x 2 (lock/unlock) EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp3) AS TableAlias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE TableAlias p0-9_subp3 index NULL b 71 NULL 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE TableAlias p0-9_subp3 index NULL b 71 NULL 3 100.00 Using index EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 PARTITION (`p10-99`); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p10-99_subp4,p10-99_subp5 index NULL PRIMARY 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p10-99_subp4,p10-99_subp5 index NULL PRIMARY 4 NULL 2 100.00 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1000000; -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (pNeg) WHERE a = 100; -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 +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 # Test how it changes the alias/keywords/reserved words SELECT * FROM t1 PARTITION; 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 @@ -1616,17 +1616,17 @@ drop table t1,t2,t3,t4,t5; create table t1 (a int) partition by hash(a) partitions 3; insert into t1 values(1),(2),(3); explain partitions select * from t1 where a=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 partition (p1) where a=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 partition (p1) where a=1 or a=2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 partition (p2) where a=1; -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 +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 drop table t1; # # Bug#59864: Crash if table empty: DELETE FROM t2 PARTITION (subp3). diff --git a/mysql-test/main/partition_hash.result b/mysql-test/main/partition_hash.result index 9a63db3f974..e62df40efe7 100644 --- a/mysql-test/main/partition_hash.result +++ b/mysql-test/main/partition_hash.result @@ -65,35 +65,35 @@ a 4 5 explain partitions select * from t1 where a < 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 100.00 Using where explain partitions select * from t1 where a is null or (a >= 5 and a <= 7); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p2,p3 ALL NULL NULL NULL NULL 7 100.00 Using where explain partitions select * from t1 where a is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 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 explain partitions select * from t1 where a is not null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 100.00 Using where explain partitions select * from t1 where a >= 1 and a < 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 5 100.00 Using where explain partitions select * from t1 where a >= 3 and a <= 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t1 where a > 2 and a < 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a > 3 and a <= 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t1 where a > 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 100.00 Using where explain partitions select * from t1 where a >= 1 and a <= 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 7 100.00 Using where drop table t1; CREATE TABLE t1 ( a int not null, diff --git a/mysql-test/main/partition_list.result b/mysql-test/main/partition_list.result index f4cd1c9da43..93315580bff 100644 --- a/mysql-test/main/partition_list.result +++ b/mysql-test/main/partition_list.result @@ -68,15 +68,15 @@ LIST `a` 3 insert into t1 values (0,0),(0,1),(1,0),(1,1),(null,0),(null,1); insert into t1 values (2,0),(2,1),(3,0),(3,1); explain partitions select * from t1 where a is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 100.00 Using where select * from t1 where a is null; a b NULL 0 NULL 1 explain partitions select * from t1 where a = 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 4 100.00 Using where select * from t1 where a = 2; a b 2 0 diff --git a/mysql-test/main/partition_mrr_aria.result b/mysql-test/main/partition_mrr_aria.result index 760ade391f9..bdc2ac2261e 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 p1,p2,p3 range key_col key_col 5 NULL # 100.00 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 diff --git a/mysql-test/main/partition_mrr_innodb.result b/mysql-test/main/partition_mrr_innodb.result index ef4a4a5e207..c4876265f53 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 p1,p2,p3 range key_col key_col 5 NULL # 100.00 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 diff --git a/mysql-test/main/partition_mrr_myisam.result b/mysql-test/main/partition_mrr_myisam.result index 474c2b62b01..738c110ab86 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 p1,p2,p3 range key_col key_col 5 NULL # 100.00 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 @@ -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 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 +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 # 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 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 +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 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 2c01ac034ea..f250ebca272 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 index NULL a 5 NULL 3 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3 index NULL a 5 NULL 3 100.00 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 841c24f474f..cf2597cf912 100644 --- a/mysql-test/main/partition_pruning.result +++ b/mysql-test/main/partition_pruning.result @@ -14,14 +14,14 @@ PARTITION p5 VALUES LESS THAN (6), PARTITION max VALUES LESS THAN MAXVALUE); INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8); EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -# # # # # # # # # 3 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +# # # # # # # # # 3 # # EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; -id select_type table partitions type possible_keys key key_len ref rows Extra -# # # # # # # # # 8 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +# # # # # # # # # 8 # # EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -# # # # # # # # # 3 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +# # # # # # # # # 3 # # DROP TABLE t1; # # Bug#49742: Partition Pruning not working correctly for RANGE @@ -41,16 +41,16 @@ a -1 0 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 2; a -1 0 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 3; a -1 @@ -58,8 +58,8 @@ a 1 2 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 4; a -1 @@ -68,8 +68,8 @@ a 2 3 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 range PRIMARY PRIMARY 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 5; a -1 @@ -79,8 +79,8 @@ a 3 4 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4 range PRIMARY PRIMARY 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4 range PRIMARY PRIMARY 4 NULL 6 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 6; a -1 @@ -91,8 +91,8 @@ a 4 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5 range PRIMARY PRIMARY 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5 range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 7; a -1 @@ -104,16 +104,16 @@ a 5 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 8 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 1; a -1 0 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 2; a -1 @@ -121,8 +121,8 @@ a 1 2 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 3; a -1 @@ -131,8 +131,8 @@ a 2 3 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 range PRIMARY PRIMARY 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 4; a -1 @@ -142,8 +142,8 @@ a 3 4 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4 range PRIMARY PRIMARY 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4 range PRIMARY PRIMARY 4 NULL 6 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 5; a -1 @@ -154,8 +154,8 @@ a 4 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5 range PRIMARY PRIMARY 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5 range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 6; a -1 @@ -167,8 +167,8 @@ a 5 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 8 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 7; a -1 @@ -181,50 +181,50 @@ a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 7; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 9 100.00 Using where; Using index SELECT * FROM t1 WHERE a = 1; a 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 100.00 SELECT * FROM t1 WHERE a = 2; a 2 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system PRIMARY NULL NULL NULL 1 100.00 SELECT * FROM t1 WHERE a = 3; a 3 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3 system PRIMARY NULL NULL NULL 1 100.00 SELECT * FROM t1 WHERE a = 4; a 4 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4 system PRIMARY NULL NULL NULL 1 100.00 SELECT * FROM t1 WHERE a = 5; a 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p5 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p5 system PRIMARY NULL NULL NULL 1 100.00 SELECT * FROM t1 WHERE a = 6; a 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 100.00 Using index SELECT * FROM t1 WHERE a = 7; a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 7; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 100.00 Using index SELECT * FROM t1 WHERE a >= 1; a 1 @@ -236,8 +236,8 @@ a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 8 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 2; a 2 @@ -248,8 +248,8 @@ a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 3; a 3 @@ -259,8 +259,8 @@ a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 6 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 4; a 4 @@ -269,8 +269,8 @@ a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4,p5,max range PRIMARY PRIMARY 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4,p5,max range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 5; a 5 @@ -278,23 +278,23 @@ a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p5,max range PRIMARY PRIMARY 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p5,max range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 6; a 6 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 7; a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 7; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 1; a 2 @@ -305,8 +305,8 @@ a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 2; a 3 @@ -316,8 +316,8 @@ a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3,p4,p5,max range PRIMARY PRIMARY 4 NULL 6 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 3; a 4 @@ -326,8 +326,8 @@ a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4,p5,max range PRIMARY PRIMARY 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4,p5,max range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 4; a 5 @@ -335,29 +335,29 @@ a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p5,max range PRIMARY PRIMARY 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p5,max range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 5; a 6 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 6; a 7 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 7; a 8 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 7; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY) PARTITION BY RANGE (a) ( @@ -373,16 +373,16 @@ a -1 0 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 2; a -1 0 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 3; a -1 @@ -390,8 +390,8 @@ a 1 2 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 4; a -1 @@ -400,8 +400,8 @@ a 2 3 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 range PRIMARY PRIMARY 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 5; a -1 @@ -411,8 +411,8 @@ a 3 4 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4 range PRIMARY PRIMARY 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4 range PRIMARY PRIMARY 4 NULL 6 100.00 Using where; Using index SELECT * FROM t1 WHERE a < 6; a -1 @@ -423,16 +423,16 @@ a 4 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 1; a -1 0 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 2; a -1 @@ -440,8 +440,8 @@ a 1 2 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 range PRIMARY PRIMARY 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 3; a -1 @@ -450,8 +450,8 @@ a 2 3 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 range PRIMARY PRIMARY 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 4; a -1 @@ -461,8 +461,8 @@ a 3 4 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4 range PRIMARY PRIMARY 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4 range PRIMARY PRIMARY 4 NULL 6 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 5; a -1 @@ -473,8 +473,8 @@ a 4 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index SELECT * FROM t1 WHERE a <= 6; a -1 @@ -486,44 +486,44 @@ a 5 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 8 100.00 Using where; Using index SELECT * FROM t1 WHERE a = 1; a 1 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 system PRIMARY NULL NULL NULL 1 100.00 SELECT * FROM t1 WHERE a = 2; a 2 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system PRIMARY NULL NULL NULL 1 100.00 SELECT * FROM t1 WHERE a = 3; a 3 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3 system PRIMARY NULL NULL NULL 1 100.00 SELECT * FROM t1 WHERE a = 4; a 4 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4 system PRIMARY NULL NULL NULL 1 100.00 SELECT * FROM t1 WHERE a = 5; a 5 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 100.00 Using index SELECT * FROM t1 WHERE a = 6; a 6 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max const PRIMARY PRIMARY 4 const 1 100.00 Using index SELECT * FROM t1 WHERE a >= 1; a 1 @@ -534,8 +534,8 @@ a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 7 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 2; a 2 @@ -545,8 +545,8 @@ a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 6 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 3; a 3 @@ -555,8 +555,8 @@ a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4,max range PRIMARY PRIMARY 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3,p4,max range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 4; a 4 @@ -564,23 +564,23 @@ a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4,max range PRIMARY PRIMARY 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4,max range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 5; a 5 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a >= 6; a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 1; a 2 @@ -590,8 +590,8 @@ a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p3,p4,max range PRIMARY PRIMARY 4 NULL 6 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 2; a 3 @@ -600,8 +600,8 @@ a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4,max range PRIMARY PRIMARY 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3,p4,max range PRIMARY PRIMARY 4 NULL 5 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 3; a 4 @@ -609,29 +609,29 @@ a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4,max range PRIMARY PRIMARY 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4,max range PRIMARY PRIMARY 4 NULL 4 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 4; a 5 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 5; a 6 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a > 6; a 7 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 max range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index DROP TABLE t1; # test of RANGE and index CREATE TABLE t1 (a DATE, KEY(a)) @@ -743,63 +743,63 @@ a 1001-00-00 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 4 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ref a a 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ref a a 4 const 1 100.00 Using index # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 7 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 7 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p2001-01-01 range a a 4 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ref a a 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ref a a 4 const 1 100.00 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 range a a 4 NULL 7 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 range a a 4 NULL 4 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 range a a 4 NULL 3 100.00 Using where; Using index # test without index ALTER TABLE t1 DROP KEY a; SELECT * FROM t1 WHERE a < '1001-01-01'; @@ -903,63 +903,63 @@ a 1001-00-00 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1001-01-01 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1001-01-01 system NULL NULL NULL NULL 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 100.00 Using where # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p2001-01-01 ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 7 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01,p2001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p0001-01-01,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where DROP TABLE t1; # test of LIST and index CREATE TABLE t1 (a DATE, KEY(a)) @@ -1072,63 +1072,63 @@ a 1001-00-00 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 4 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 4 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ref a a 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ref a a 4 const 1 100.00 Using index # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ref a a 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ref a a 4 const 1 100.00 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 100.00 Using where; Using index # test without index ALTER TABLE t1 DROP KEY a; SELECT * FROM t1 WHERE a < '1001-01-01'; @@ -1232,63 +1232,63 @@ a 1001-00-00 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1001-01-01 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1001-01-01 system NULL NULL NULL NULL 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 100.00 Using where # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01 ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where DROP TABLE t1; # TO_SECONDS, test of LIST and index CREATE TABLE t1 (a DATE, KEY(a)) @@ -1401,63 +1401,63 @@ a 1001-00-00 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 4 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1001-01-01 system a NULL NULL NULL 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 range a a 4 NULL 4 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 4 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ref a a 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ref a a 4 const 1 100.00 Using index # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL range a a 4 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ref a a 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ref a a 4 const 1 100.00 Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 range a a 4 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01 range a a 4 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 range a a 4 NULL 3 100.00 Using where; Using index # test without index ALTER TABLE t1 DROP KEY a; SELECT * FROM t1 WHERE a < '1001-01-01'; @@ -1561,63 +1561,63 @@ a 1001-00-00 1001-01-01 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1001-01-01 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1001-01-01 system NULL NULL NULL NULL 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1001-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 100.00 Using where # Disabling warnings for the invalid date EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2001-01-01,pNULL ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = '1999-02-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL ALL NULL NULL NULL NULL 3 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0000-00-00' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p0000-01-02,p1001-01-01 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-02' AND '1002-00-00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pNULL,p1001-01-01 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pNULL,p1001-01-01 ALL NULL NULL NULL NULL 4 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a BETWEEN '0001-01-01' AND '1001-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0001-01-01,pNULL,p1001-01-01 ALL NULL NULL NULL NULL 5 100.00 Using where DROP TABLE t1; # Test with DATETIME column NOT NULL CREATE TABLE t1 ( @@ -1635,140 +1635,140 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), (1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07'); EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 index NULL PRIMARY 9 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090402 index NULL PRIMARY 9 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 index NULL PRIMARY 9 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090402 index NULL PRIMARY 9 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 9 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 9 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 9 NULL 6 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 index NULL PRIMARY 9 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090402 index NULL PRIMARY 9 NULL 3 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 index NULL PRIMARY 9 NULL 13 100.00 Using where; Using index DROP TABLE t1; # Test with DATE column NOT NULL CREATE TABLE t1 ( @@ -1786,140 +1786,140 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), (1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07'); EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 index NULL PRIMARY 7 NULL 2 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 index NULL PRIMARY 7 NULL 7 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 index NULL PRIMARY 7 NULL 8 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 index NULL PRIMARY 7 NULL 5 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 index NULL PRIMARY 7 NULL 10 100.00 Using where; Using index DROP TABLE t1; # Test with DATETIME column NULL CREATE TABLE t1 ( @@ -1936,140 +1936,140 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), (1, '2009-04-03'), (2, '2009-04-03'), (1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07'); EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 3 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 3 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 6 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090402 ALL NULL NULL NULL NULL 3 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 13 100.00 Using where DROP TABLE t1; # Test with DATE column NULL CREATE TABLE t1 ( @@ -2086,140 +2086,140 @@ INSERT INTO t1 VALUES (1, '2009-01-01'), (1, '2009-04-01'), (2, '2009-04-01'), (1, '2009-04-04'), (2, '2009-04-04'), (1, '2009-04-05'), (1, '2009-04-06'), (1, '2009-04-07'); EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:59' AS DATETIME); -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:59' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03' AS DATE); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-02 23:59:59'; -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-02 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090403 ALL NULL NULL NULL NULL 2 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > '2009-04-03'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402,p20090403 ALL NULL NULL NULL NULL 7 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-03 00:00:01' AS DATETIME); -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-03 00:00:01' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090404,p20090405 ALL NULL NULL NULL NULL 8 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b <= CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090402 ALL NULL NULL NULL NULL 5 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = CAST('2009-04-02 23:59:58' AS DATETIME); -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b >= CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b > CAST('2009-04-02 23:59:58' AS DATETIME); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p20090401,p20090403,p20090404,p20090405 ALL NULL NULL NULL NULL 10 100.00 Using where DROP TABLE t1; # For better code coverage of the patch CREATE TABLE t1 ( @@ -2234,8 +2234,8 @@ PARTITION p20090405 VALUES LESS THAN MAXVALUE); INSERT INTO t1 VALUES (1, '2009-01-01'), (2, NULL); # test with an invalid date, which lead to item->null_value is set. EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b < CAST('2009-04-99' AS DATETIME); -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 +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: Warning 1292 Incorrect datetime value: '2009-04-99' DROP TABLE t1; @@ -2254,36 +2254,36 @@ 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 partitions type possible_keys key key_len ref rows 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 drop table t1; create table t1 ( a int(11) not null ) partition by hash (a) partitions 2; insert into t1 values (1),(2),(3); explain partitions select * from t1 where a=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a=2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a=1 or a=2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 3 100.00 Using where create table t2 ( a int not null, b int not null ) partition by key(a,b) partitions 2; insert into t2 values (1,1),(2,2),(3,3); explain partitions select * from t2 where a=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t2 where b=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t2 where a=1 and b=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where create table t3 ( a int ) @@ -2293,39 +2293,39 @@ partition p1 values less than (20) ); insert into t3 values (5),(15); explain partitions select * from t3 where a=11; -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 +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 explain partitions select * from t3 where a=10; -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 +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 explain partitions select * from t3 where a=20; -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 +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 explain partitions select * from t3 where a=30; -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 +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 create table t4 (a int not null, b int not null) partition by LIST (a+b) ( partition p0 values in (12), partition p1 values in (14) ); insert into t4 values (10,2), (10,4); explain partitions select * from t4 where (a=10 and b=1) or (a=10 and b=2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t4 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 p0 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t4 where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t4 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 p0 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t4 where (a=10 and b=2) or (a=10 and b=3) or (a=10 and b = 4); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t4 p0,p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 p0,p1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t4 where (a=10 and b=1) or a=11; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t4 p0,p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 p0,p1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t4 where (a=10 and b=2) or a=11; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t4 p0,p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 p0,p1 ALL NULL NULL NULL NULL 2 100.00 Using where drop table t1, t2, t3, t4; create table t5 (a int not null, b int not null, c int not null, d int not null) @@ -2336,30 +2336,30 @@ partition p1 values in (14) ); insert into t5 values (10,2,0,0), (10,4,0,0), (10,2,0,1), (10,4,0,1); explain partitions select * from t5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 100.00 explain partitions select * from t5 where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t5 where (a=10 and b=2) or (a=10 and b=3) or (a=10 and b = 4); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t5 where (c=1 and d=1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p1_p1sp0 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 p0_p0sp0,p1_p1sp0 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t5 where (c=2 and d=1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or (c=2 and d=1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or (b=2 and c=2 and d=1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t5 p0_p0sp0,p0_p0sp1,p1_p1sp1 ALL NULL NULL NULL NULL 3 100.00 Using where create table t6 (a int not null) partition by LIST(a) ( partition p1 values in (1), partition p3 values in (3), @@ -2369,38 +2369,38 @@ partition p9 values in (9) ); insert into t6 values (1),(3),(5); explain partitions select * from t6 where a < 1; -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 +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 explain partitions select * from t6 where a <= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p1 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t6 where a > 9; -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 +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 explain partitions select * from t6 where a >= 9; -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 +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 explain partitions select * from t6 where a > 0 and a < 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p1,p3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p1,p3 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t6 where a > 5 and a < 12; -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 +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 explain partitions select * from t6 where a > 3 and a < 8 ; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p5,p7 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p5,p7 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t6 where a >= 0 and a <= 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p1,p3,p5 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p1,p3,p5 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t6 where a >= 5 and a <= 12; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t6 where a >= 3 and a <= 8; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t6 where a > 3 and a < 5; -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 +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 drop table t6; create table t6 (a int unsigned not null) partition by LIST(a) ( partition p1 values in (1), @@ -2411,38 +2411,38 @@ partition p9 values in (9) ); insert into t6 values (1),(3),(5); explain partitions select * from t6 where a < 1; -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 +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 explain partitions select * from t6 where a <= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p1 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t6 where a > 9; -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 +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 explain partitions select * from t6 where a >= 9; -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 +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 explain partitions select * from t6 where a > 0 and a < 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p1,p3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p1,p3 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t6 where a > 5 and a < 12; -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 +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 explain partitions select * from t6 where a > 3 and a < 8 ; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p5,p7 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p5,p7 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t6 where a >= 0 and a <= 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p1,p3,p5 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p1,p3,p5 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t6 where a >= 5 and a <= 12; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p5,p7,p9 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t6 where a >= 3 and a <= 8; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t6 where a > 3 and a < 5; -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 +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 create table t7 (a int not null) partition by RANGE(a) ( partition p10 values less than (10), partition p30 values less than (30), @@ -2452,74 +2452,74 @@ partition p90 values less than (90) ); insert into t7 values (10),(30),(50); explain partitions select * from t7 where a < 5; -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 +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 explain partitions select * from t7 where a < 9; -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 +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 explain partitions select * from t7 where a <= 9; -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 +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 explain partitions select * from t7 where a = 9; -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 +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 explain partitions select * from t7 where a >= 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a > 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a < 10; -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 +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 explain partitions select * from t7 where a <= 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t7 where a = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p30 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p30 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t7 where a >= 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a > 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a < 89; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a <= 89; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a = 89; -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 +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 explain partitions select * from t7 where a > 89; -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 +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 explain partitions select * from t7 where a >= 89; -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 +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 explain partitions select * from t7 where a < 90; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a <= 90; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a = 90; -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 +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 explain partitions select * from t7 where a > 90; -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 +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 explain partitions select * from t7 where a >= 90; -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 +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 explain partitions select * from t7 where a > 91; -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 +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 explain partitions select * from t7 where a > 11 and a < 29; -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 +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 drop table t7; create table t7 (a int unsigned not null) partition by RANGE(a) ( partition p10 values less than (10), @@ -2530,74 +2530,74 @@ partition p90 values less than (90) ); insert into t7 values (10),(30),(50); explain partitions select * from t7 where a < 5; -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 +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 explain partitions select * from t7 where a < 9; -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 +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 explain partitions select * from t7 where a <= 9; -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 +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 explain partitions select * from t7 where a = 9; -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 +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 explain partitions select * from t7 where a >= 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a > 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a < 10; -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 +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 explain partitions select * from t7 where a <= 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t7 where a = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p30 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p30 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t7 where a >= 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a > 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a < 89; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a <= 89; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a = 89; -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 +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 explain partitions select * from t7 where a > 89; -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 +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 explain partitions select * from t7 where a >= 89; -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 +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 explain partitions select * from t7 where a < 90; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a <= 90; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t7 where a = 90; -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 +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 explain partitions select * from t7 where a > 90; -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 +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 explain partitions select * from t7 where a >= 90; -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 +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 explain partitions select * from t7 where a > 91; -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 +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 explain partitions select * from t7 where a > 11 and a < 29; -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 +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 create table t8 (a date not null) partition by RANGE(YEAR(a)) ( partition p0 values less than (1980), partition p1 values less than (1990), @@ -2605,8 +2605,8 @@ partition p2 values less than (2000) ); insert into t8 values ('1985-05-05'),('1995-05-05'); explain partitions select * from t8 where a < '1980-02-02'; -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 +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 create table t9 (a date not null) partition by RANGE(TO_DAYS(a)) ( partition p0 values less than (732299), -- 2004-12-19 partition p1 values less than (732468), -- 2005-06-06 @@ -2614,11 +2614,11 @@ partition p2 values less than (732664) -- 2005-12-19 ); insert into t9 values ('2005-05-05'), ('2005-04-04'); explain partitions select * from t9 where a < '2004-12-19'; -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 +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 explain partitions select * from t9 where a <= '2004-12-19'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t9 p0,p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t9 p0,p1 ALL NULL NULL NULL NULL 2 100.00 Using where drop table t5,t6,t7,t8,t9; create table t1 ( a1 int not null @@ -2630,14 +2630,14 @@ partition p2 values less than (9) ); insert into t1 values (1),(2),(3); explain partitions select * from t1 where a1 > 3; -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 +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 explain partitions select * from t1 where a1 >= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a1 < 3 and a1 > 3; -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 +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 drop table t1; create table t3 (a int, b int) partition by list(a) subpartition by hash(b) subpartitions 4 ( @@ -2648,23 +2648,23 @@ partition p3 values in (4) ); insert into t3 values (1,1),(2,2),(3,3); explain partitions select * from t3 where a=2 or b=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 p0_p0sp1,p1_p1sp0,p1_p1sp1,p1_p1sp2,p1_p1sp3,p2_p2sp1,p3_p3sp1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 p0_p0sp1,p1_p1sp0,p1_p1sp1,p1_p1sp2,p1_p1sp3,p2_p2sp1,p3_p3sp1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t3 where a=4 or b=2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp0,p3_p3sp1,p3_p3sp2,p3_p3sp3 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp0,p3_p3sp1,p3_p3sp2,p3_p3sp3 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t3 where (a=2 or b=1) and (a=4 or b=2) ; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 p1_p1sp2,p3_p3sp1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 p1_p1sp2,p3_p3sp1 system NULL NULL NULL NULL 1 100.00 drop table t3; create table t1 (a int) partition by hash(a) partitions 2; insert into t1 values (1),(2); explain partitions select * from t1 where a is null; -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 +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 explain partitions select * from t1 where a is not null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 100.00 Using where drop table t1; create table t1 (a int not null, b int not null, key(a), key(b)) partition by hash(a) partitions 4; @@ -2675,29 +2675,29 @@ insert into t1 values (13,13),(14,14),(15,15),(16,16); explain partitions select * from t1 X, t1 Y where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE X p1,p2 range a,b a 4 NULL 4 Using where -1 SIMPLE Y p2,p3 ref|filter a,b b|a 4|4 test.X.b 2 (50%) Using where; Using rowid filter +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE X p1,p2 range a,b a 4 NULL 4 100.00 Using where +1 SIMPLE Y p2,p3 ref|filter a,b b|a 4|4 test.X.b 2 (50%) 50.00 Using where; Using rowid filter explain partitions select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE X p1,p2 range a a 4 NULL 4 Using where -1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE X p1,p2 range a a 4 NULL 4 100.00 Using where +1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2 100.00 drop table t1; create table t1 (a int) partition by hash(a) partitions 20; insert into t1 values (1),(2),(3); explain partitions select * from t1 where a > 1 and a < 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a >= 1 and a < 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a > 1 and a <= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2,p3 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a >= 1 and a <= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2,p3 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2,p3 ALL NULL NULL NULL NULL 3 100.00 Using where drop table t1; create table t1 (a int, b int) partition by list(a) subpartition by hash(b) subpartitions 20 @@ -2709,11 +2709,11 @@ partition p3 values in (3) ); insert into t1 values (1,1),(2,2),(3,3); explain partitions select * from t1 where b > 1 and b < 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp2 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where b > 1 and b < 3 and (a =1 or a =2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1_p1sp2,p2_p2sp2 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1_p1sp2,p2_p2sp2 system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1 (a int) partition by list(a) ( partition p0 values in (1,2), @@ -2780,29 +2780,29 @@ insert into t2 select a,3 from t1 where a >= 400 and a < 600; insert into t2 select a,4 from t1 where a >= 600 and a < 800; insert into t2 select a,5 from t1 where a >= 800 and a < 1001; explain partitions select * from t2; -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 1010 +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 1010 100.00 explain partitions select * from t2 where a < 801 and a > 200; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p1,p2,p3,p4 ALL NULL NULL NULL NULL 800 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p1,p2,p3,p4 ALL NULL NULL NULL NULL 800 100.00 Using where explain partitions select * from t2 where a < 801 and a > 800; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 100.00 Using where explain partitions select * from t2 where a > 600; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 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 400 100.00 Using where explain partitions select * from t2 where a > 600 and b = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 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 400 100.00 Using where explain partitions select * from t2 where a > 600 and b = 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 400 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 400 100.00 Using where explain partitions select * from t2 where a > 600 and b = 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p3,p4 ALL NULL NULL NULL NULL 400 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 400 100.00 Using where 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 1010 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 1010 100.00 Using where flush status; update t2 set b = 100 where b = 6; show status like 'Handler_read_rnd_next'; @@ -2850,90 +2850,90 @@ insert into t2 select a,7 from t1 where a >= 700 and a < 800; insert into t2 select a,8 from t1 where a >= 800 and a < 900; insert into t2 select a,9 from t1 where a >= 900 and a < 1001; explain partitions select * from t2; -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 910 +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 910 100.00 explain partitions select * from t2 where a = 101; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 110 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 110 100.00 Using where explain partitions select * from t2 where a = 550; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 200 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 200 100.00 Using where explain partitions select * from t2 where a = 833; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p4 ALL NULL NULL NULL NULL 200 100.00 Using where explain partitions select * from t2 where (a = 100 OR a = 900); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 310 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p4 ALL NULL NULL NULL NULL 310 100.00 Using where explain partitions select * from t2 where (a > 100 AND a < 600); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 510 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1,p2 ALL NULL NULL NULL NULL 510 100.00 Using where 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 +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 explain extended select * from t2 where b = 6; 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 +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 explain extended select * from t2 where b in (1,3,5); 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 +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 explain extended select * from t2 where b in (2,4,6); 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 +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 explain extended select * from t2 where b in (7,8,9); 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 +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 explain extended select * from t2 where b > 5; 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 +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 explain extended select * from t2 where b > 5 and b < 8; 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 +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 explain extended select * from t2 where b > 5 and b < 7; 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 +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 explain extended select * from t2 where b > 0 and b < 5; 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; -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 +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 flush status; update t2 set a = 111 where b = 10; show status like 'Handler_read_rnd_next'; @@ -3033,8 +3033,8 @@ select * from t1 where f_int1 is null; f_int1 NULL explain partitions select * from t1 where f_int1 is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part4_part4sp0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part4_part4sp0 system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1 (a int not null, b int not null) partition by list(a) @@ -3047,8 +3047,8 @@ partition p2 values in (3) insert into t1 values (1,1),(1,2),(1,3),(1,4), (2,1),(2,2),(2,3),(2,4); explain partitions select * from t1 where a=1 AND (b=1 OR b=2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0_p0sp1,p0_p0sp2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0_p0sp1,p0_p0sp2 ALL NULL NULL NULL NULL 2 100.00 Using where drop table t1; create table t1 (a int, b int not null) partition by list(a) @@ -3062,17 +3062,17 @@ partition pn values in (NULL) insert into t1 values (1,1),(1,2),(1,3),(1,4), (2,1),(2,2),(2,3),(2,4), (NULL,1); explain partitions select * from t1 where a IS NULL AND (b=1 OR b=2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pn_pnsp0,pn_pnsp1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pn_pnsp0,pn_pnsp1 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where (a IS NULL or a < 1) AND (b=1 OR b=2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pn_pnsp0,pn_pnsp1 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pn_pnsp0,pn_pnsp1 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where (a IS NULL or a < 2) AND (b=1 OR b=2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 5 100.00 Using where explain partitions select * from t1 where (a IS NULL or a <= 1) AND (b=1 OR b=2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0_p0sp0,p0_p0sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL 5 100.00 Using where drop table t1; create table t1 ( a int) partition by list (MOD(a, 10)) ( partition p0 values in (0), partition p1 values in (1), @@ -3082,8 +3082,8 @@ partition p6 values in (6), partition pn values in (NULL) ); insert into t1 values (NULL), (0),(1),(2),(3),(4),(5),(6); explain partitions select * from t1 where a is null or a < 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,pn ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,pn ALL NULL NULL NULL NULL 8 100.00 Using where drop table t1; create table t1 (s1 int) partition by list (s1) (partition p1 values in (0), @@ -3094,8 +3094,8 @@ select count(*) from t1 where s1 < 0 or s1 is null; count(*) 1 explain partitions select count(*) from t1 where s1 < 0 or s1 is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3 system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1 (a char(32) primary key) partition by key() @@ -3113,8 +3113,8 @@ select * from t1 where s1 = 0 or s1 is null; s1 insert into t1 values ('aa'),('bb'),('0'); explain partitions select * from t1 where s1 = 0 or s1 is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 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 drop table t1; create table t2 (a int, b int) partition by LIST(a) @@ -3133,13 +3133,14 @@ key NULL key_len NULL ref NULL rows 2 +filtered 100.00 Extra drop table t2; create table t1 (s1 int); explain partitions select 1 from t1 union all select 2; -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 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 system NULL NULL NULL NULL 0 0.00 Const row not found +2 UNION NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used drop table t1; create table t1 (a bigint unsigned not null) partition by range(a) ( partition p0 values less than (10), @@ -3152,25 +3153,25 @@ insert into t1 values (5),(15),(105),(1005); insert into t1 values (18446744073709551000+1); insert into t1 values (18446744073709551614-1); explain partitions select * from t1 where a < 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a >= 18446744073709551000-1 and a <= 18446744073709551000+1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3,p4 ALL NULL NULL NULL NULL 3 100.00 Using where explain partitions select * from t1 where a between 18446744073709551001 and 18446744073709551002; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a = 18446744073709551000; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a = 18446744073709551613; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a = 18446744073709551614; -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 +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 drop table t1; create table t1 (a int) partition by range(a) ( @@ -3187,41 +3188,41 @@ partition p2 values less than (255) insert into t1 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE); insert into t2 values (0x20), (0x20), (0x41), (0x41), (0xFE), (0xFE); explain partitions select * from t1 where a=0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where explain partitions select * from t2 where a=0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where explain partitions select * from t1 where a=0xFE; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t2 where a=0xFE; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a > 0xFE AND a <= 0xFF; -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 +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 explain partitions select * from t2 where a > 0xFE AND a <= 0xFF; -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 +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 explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a < 64 AND a >= 63; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where explain partitions select * from t2 where a < 64 AND a >= 63; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where explain partitions select * from t1 where a <= 64 AND a >= 63; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t2 where a <= 64 AND a >= 63; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 4 100.00 Using where drop table t1; drop table t2; create table t1(a bigint unsigned not null) partition by range(a+0) ( @@ -3234,15 +3235,15 @@ insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1); insert into t1 values (9),(19),(0xFFFF0000FFFF000-1), (0xFFFF0000FFFFFFF-1); explain partitions select * from t1 where a >= 2305561538531885056-10 and a <= 2305561538531885056-8; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t1 where a > 0xFFFFFFFFFFFFFFEC and a < 0xFFFFFFFFFFFFFFEE; -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 +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 explain partitions select * from t1 where a>=0 and a <= 0xFFFFFFFFFFFFFFFF; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2,p3,p4 ALL NULL NULL NULL NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2,p3,p4 ALL NULL NULL NULL NULL 8 100.00 Using where drop table t1; create table t1 (a bigint) partition by range(a+0) ( partition p1 values less than (-1000), @@ -3252,8 +3253,8 @@ partition p4 values less than (1000) ); insert into t1 values (-15),(-5),(5),(15),(-15),(-5),(5),(15); explain partitions select * from t1 where a>-2 and a <=0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3 ALL NULL NULL NULL NULL 4 100.00 Using where drop table t1; CREATE TABLE t1 ( recdate DATETIME NOT NULL ) PARTITION BY RANGE( TO_DAYS(recdate) ) ( @@ -3266,8 +3267,8 @@ INSERT INTO t1 VALUES ('2007-03-08 12:00:00'); INSERT INTO t1 VALUES ('2007-03-15 12:00:00'); must use p0 only: explain partitions select * from t1 where recdate < '2007-03-08 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where drop table t1; CREATE TABLE t1 ( recdate DATETIME NOT NULL ) PARTITION BY RANGE( YEAR(recdate) ) ( @@ -3280,8 +3281,8 @@ INSERT INTO t1 VALUES ('2006-03-01 12:00:00'); INSERT INTO t1 VALUES ('2006-03-01 12:00:00'); must use p0 only: explain partitions select * from t1 where recdate < '2006-01-01 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where drop table t1; # # BUG#33730 Full table scan instead selected partitions for query more than 10 partitions @@ -3296,11 +3297,11 @@ partition p2 values less than (255) ); insert into t1 select A.a + 10*B.a from t0 A, t0 B; explain partitions select * from t1 where a between 10 and 13; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 64 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 64 100.00 Using where explain partitions select * from t1 where a between 10 and 10+33; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 100 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 100 100.00 Using where drop table t0, t1; # # Bug#71095: Wrong results with PARTITION BY LIST COLUMNS() @@ -3368,53 +3369,53 @@ c1 c2 c3 c4 SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4; c1 c2 c3 c4 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 1; -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 +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 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 range PRIMARY PRIMARY 8 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 range PRIMARY PRIMARY 8 NULL 1 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 const PRIMARY PRIMARY 8 const,const 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 >= 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 3 75.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 > 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 50.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 < 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1 range PRIMARY PRIMARY 8 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1 range PRIMARY PRIMARY 8 NULL 2 50.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 1 AND c2 <= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 3 75.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 50.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 const PRIMARY PRIMARY 8 const,const 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 2 50.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 < 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 2 50.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 <= 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 range PRIMARY PRIMARY 8 NULL 3 75.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 = 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 const PRIMARY PRIMARY 8 const,const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 const PRIMARY PRIMARY 8 const,const 1 100.00 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 >= 4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p2 range PRIMARY PRIMARY 8 NULL 1 100.00 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE c1 = 2 AND c2 > 4; -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 +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 DROP TABLE t1; # # MDEV-6239: Partition pruning is not working as expected in an inner query @@ -3464,9 +3465,9 @@ explain partitions select * from t1 where company_id = 1000 and dept_id in (select dept_id from t2 where COMPANY_ID = 1000); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t2 p_1000 ref PRIMARY PRIMARY 8 const 3 Using index -1 PRIMARY t1 p_1000 ALL PRIMARY 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 filtered Extra +1 PRIMARY t2 p_1000 ref PRIMARY PRIMARY 8 const 3 100.00 Using index +1 PRIMARY t1 p_1000 ALL PRIMARY NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) drop table t1,t2; # # MDEV-9505: Valgrind failure in SEL_ARG::store_min,find_used_partitions,... @@ -3518,14 +3519,14 @@ partition p4 values in (4) insert into t3 select mod(a,5), a from t0; explain partitions select * from t1 left join t3 on (t1.a=t3.a and t3.part_id=3); -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 p3 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 filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t3 p3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) # The following should have partitions="p3", NOT p0,p1,p2,p3,p4: explain partitions select * from t1 left join (t3 join t2) on (t1.a=t3.a and t3.a=t2.b and t3.part_id=3); -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 p3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 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 10 100.00 +1 SIMPLE t3 p3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (incremental, BNL join) drop table t0,t1,t2,t3; diff --git a/mysql-test/main/partition_pruning.test b/mysql-test/main/partition_pruning.test index d59f52be313..28c21435d1e 100644 --- a/mysql-test/main/partition_pruning.test +++ b/mysql-test/main/partition_pruning.test @@ -25,11 +25,11 @@ PARTITION max VALUES LESS THAN MAXVALUE); INSERT INTO t1 VALUES (-1),(0),(1),(2),(3),(4),(5),(6),(7),(8); ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # 12 # EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # 12 # EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a < 7; ---replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # +--replace_column 1 # 2 # 3 # 4 # 5 # 6 # 7 # 8 # 9 # 11 # 12 # EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a <= 1; DROP TABLE t1; diff --git a/mysql-test/main/partition_range.result b/mysql-test/main/partition_range.result index 91b4f81afcb..c7a5654dbbe 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 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 +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; 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 range a a 5 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 4 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 range a a 5 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 range a a 5 NULL 4 100.00 Using where; Using index DROP TABLE t1; create table t1 (a DATETIME) partition by range (TO_DAYS(a)) @@ -52,20 +52,20 @@ RANGE to_seconds(`a`) 63342604800 INSERT INTO t1 VALUES ('2007-03-01 12:00:00'), ('2007-03-07 12:00:00'); INSERT INTO t1 VALUES ('2007-03-08 12:00:00'), ('2007-03-15 12:00:00'); explain partitions select * from t1 where a < '2007-03-08 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where explain partitions select * from t1 where a < '2007-03-08 00:00:01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t1 where a <= '2007-03-08 00:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t1 where a <= '2007-03-07 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where explain partitions select * from t1 where a < '2007-03-07 23:59:59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 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 2 100.00 Using where show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -85,14 +85,14 @@ a 2003-12-30 2004-12-31 explain partitions select * from t1 where a <= '2003-12-31'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 select * from t1 where a <= '2003-12-31'; a 2003-12-30 explain partitions select * from t1 where a <= '2005-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 100.00 Using where select * from t1 where a <= '2005-01-01'; a 2003-12-30 @@ -116,14 +116,14 @@ a 2004-01-01 11:59:29 2005-01-01 11:59:59 explain partitions select * from t1 where a <= '2004-01-01 11:59.59'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 system NULL NULL NULL NULL 1 100.00 select * from t1 where a <= '2004-01-01 11:59:59'; a 2004-01-01 11:59:29 explain partitions select * from t1 where a <= '2005-01-01'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 100.00 Using where select * from t1 where a <= '2005-01-01'; a 2004-01-01 11:59:29 @@ -208,20 +208,20 @@ a select * from t1 where a > 1; a explain partitions select * from t1 where a is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pnull system NULL NULL NULL NULL 1 100.00 explain partitions select * from t1 where a >= 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a < 0; -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 +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 explain partitions select * from t1 where a <= 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a > 1; -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 +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 drop table t1; create table t1 (a int unsigned, b int unsigned) partition by range (a) @@ -250,20 +250,20 @@ a b select * from t1 where a > 1; a b explain partitions select * from t1 where a is null; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a >= 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t1 where a < 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1 ALL NULL NULL NULL NULL 2 100.00 Using where explain partitions select * from t1 where a <= 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 100.00 Using where explain partitions select * from t1 where a > 1; -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 +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 drop table t1; CREATE TABLE t1 ( a int not null, @@ -897,8 +897,8 @@ a 2004-09-30 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= '2004-07-01' AND a <= '2004-09-30'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3xx,p407,p408,p409 ALL NULL NULL NULL NULL 18 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3xx,p407,p408,p409 ALL NULL NULL NULL NULL 18 100.00 Using where SELECT * from t1 WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR (a >= '2005-07-01' AND a <= '2005-09-30'); @@ -924,8 +924,8 @@ a EXPLAIN PARTITIONS SELECT * from t1 WHERE (a >= '2004-07-01' AND a <= '2004-09-30') OR (a >= '2005-07-01' AND a <= '2005-09-30'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p3xx,p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 27 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p3xx,p407,p408,p409,p507,p508,p509 ALL NULL NULL NULL NULL 27 100.00 Using where DROP TABLE t1; create table t1 (a int); insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 range a a 5 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 range a a 5 NULL 2 100.00 Using where; Using index EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 5 NULL 2 100.00 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 8f4355a2aa6..cb89b367a80 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 100.00 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 100.00 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 100.00 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -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 +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 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 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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 100.00 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 @@ -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 partitions type possible_keys key key_len ref rows 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 explain select fld3 from t2 where fld1=fld1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 +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 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 partitions type possible_keys key key_len ref rows 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 select min(fld1),max(fld1),count(*) from t2; min(fld1) max(fld1) count(*) 0 1232609 1199 diff --git a/mysql-test/main/processlist_notembedded.result b/mysql-test/main/processlist_notembedded.result index 65df881669d..6d60e04e134 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 partitions type possible_keys key key_len ref rows 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 sleep(100000) KILL QUERY $con_id; diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index 6a734670010..2e58abecf7e 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 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 +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 +6 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +5 SUBQUERY NULL 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 NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL 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 NULL Impossible WHERE noticed after reading const tables execute stmt1 ; -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 +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 +6 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +5 SUBQUERY NULL 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 NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL 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 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 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 +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 +6 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +5 SUBQUERY NULL 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 NULL Impossible WHERE noticed after reading const tables +3 SUBQUERY NULL 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 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 partitions 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 filtered Extra +- - - - - - - - - NULL NULL Impossible WHERE set @v=0; execute stmt using @v; -id select_type table partitions 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 filtered Extra +- - - - - - - - - 4 100.00 Using where set @v=5; execute stmt using @v; -id select_type table partitions 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 filtered Extra +- - - - - - - - - NULL NULL Impossible WHERE drop table t1; deallocate prepare stmt; create table t1 (a int); @@ -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 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 +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort EXECUTE stmt; -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 +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort DEALLOCATE PREPARE stmt; DROP TABLE t1; @@ -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 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 +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 +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found EXECUTE stmt; -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 +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 +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found deallocate prepare stmt; DROP TABLE t1, t2; # @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 SIMPLE b NULL system NULL NULL NULL NULL 0 0.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 DEALLOCATE PREPARE stmt; DROP TABLE t1; # diff --git a/mysql-test/main/ps_11bugs.result b/mysql-test/main/ps_11bugs.result index 263816b74f6..21fed4fd707 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 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 +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 +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 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 95a488da34c..437f345def1 100644 --- a/mysql-test/main/ps_1general.result +++ b/mysql-test/main/ps_1general.result @@ -448,9 +448,10 @@ def key 253 64 0 Y 0 39 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 filtered 5 4 6 Y 32896 2 63 def Extra 253 255 14 N 1 39 8 -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 +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 filesort SET @arg00=1 ; prepare stmt1 from ' explain select a from t1 where a > ? order by b '; execute stmt1 using @arg00; @@ -465,9 +466,10 @@ def key 253 64 7 Y 0 39 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 filtered 5 4 6 Y 32896 2 63 def Extra 253 255 37 N 1 39 8 -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 +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 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 95b8d79e84a..31c9fbef81f 100644 --- a/mysql-test/main/ps_2myisam.result +++ b/mysql-test/main/ps_2myisam.result @@ -1163,9 +1163,10 @@ def key 253 64 0 Y 0 39 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 filtered 5 4 6 Y 32896 2 63 def Extra 253 255 0 N 1 39 8 -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 100.00 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 5b1d60ed1f9..7a6cd69173c 100644 --- a/mysql-test/main/ps_3innodb.result +++ b/mysql-test/main/ps_3innodb.result @@ -1163,9 +1163,10 @@ def key 253 64 0 Y 0 39 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 filtered 5 4 6 Y 32896 2 63 def Extra 253 255 0 N 1 39 8 -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 100.00 test_sequence ------ delete tests ------ delete from t1 ; diff --git a/mysql-test/main/ps_4heap.result b/mysql-test/main/ps_4heap.result index e70e8f0fa34..66863fdb38d 100644 --- a/mysql-test/main/ps_4heap.result +++ b/mysql-test/main/ps_4heap.result @@ -1164,9 +1164,10 @@ def key 253 64 0 Y 0 39 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 filtered 5 4 6 Y 32896 2 63 def Extra 253 255 0 N 1 39 8 -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 100.00 test_sequence ------ delete tests ------ delete from t1 ; diff --git a/mysql-test/main/ps_5merge.result b/mysql-test/main/ps_5merge.result index 42c12f51388..dc60b7ec5f2 100644 --- a/mysql-test/main/ps_5merge.result +++ b/mysql-test/main/ps_5merge.result @@ -1207,9 +1207,10 @@ def key 253 64 0 Y 0 39 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 filtered 5 4 6 Y 32896 2 63 def Extra 253 255 0 N 1 39 8 -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 100.00 test_sequence ------ delete tests ------ delete from t1 ; @@ -4576,9 +4577,10 @@ def key 253 64 0 Y 0 39 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 filtered 5 4 6 Y 32896 2 63 def Extra 253 255 0 N 1 39 8 -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 100.00 test_sequence ------ delete tests ------ delete from t1 ; diff --git a/mysql-test/main/range.result b/mysql-test/main/range.result index 2d550750dfc..527181b04d3 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 partitions type possible_keys key key_len ref rows 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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 2 100.00 Using index condition; Using where; Using join buffer (flat, BNL join) explain select count(*) from t1 where x in (1); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref x x 5 const 1 100.00 Using index explain select count(*) from t1 where x in (1,2,3,4); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range x x 5 NULL 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref j1 j1 4 const 1 100.00 Using index +1 SIMPLE t1 NULL range i1 i1 4 NULL 7 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref j1 j1 4 const 1 100.00 Using index +1 SIMPLE t1 NULL range i1 i1 4 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter a,b b|a 5|5 const 15 (5%) 5.41 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 111 100.00 Using index condition +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 100.00 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 111 100.00 Using index condition +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 100.00 explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 112 100.00 Using index condition +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 100.00 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 112 100.00 Using index condition +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 100.00 Using where; Using index select * from t1 where a > -1; a 18446744073709551614 18446744073709551615 explain select * from t1 where a < -1; -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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 11 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 11 const 2 100.00 Using index condition explain select * from t1 where a=binary 'aaa'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 11 const 2 100.00 Using index condition explain select * from t1 where a='aaa' collate latin1_bin; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 11 const 2 100.00 Using index condition explain select * from t1 where a='aaa' collate latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 2 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 2 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE v NULL ALL OXLEFT,OXRIGHT,OXROOTID NULL NULL NULL 12 50.00 Using where +1 SIMPLE s NULL ALL OXLEFT NULL NULL NULL 12 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range status status 23 NULL 18 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range status status 23 NULL 18 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 100.00 Using where; Using index EXPLAIN SELECT status FROM t1 WHERE status NOT IN ('A','B'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 17 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 17 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 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 EXPLAIN SELECT a,b FROM v1 WHERE a < 2 and b=3; -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 +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 EXPLAIN SELECT a,b FROM t1 WHERE a < 2; -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 +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 EXPLAIN SELECT a,b FROM v1 WHERE a < 2; -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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 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 8 NULL # 100.00 Using where; Using index explain select * from v1 where a in (3,4) and b in (1,2,3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 100.00 Using where; Using index explain select * from t1 where a between 3 and 4 and b between 1 and 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 100.00 Using where; Using index explain select * from v1 where a between 3 and 4 and b between 1 and 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 13 NULL # 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 13 NULL # 100.00 Using index condition explain select * from t1 where a = 'a' or a='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL # 100.00 Using index condition explain select * from t2 where a between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 13 const # 100.00 Using index condition explain select * from t2 where a = 'a' or a='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 13 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 13 NULL # 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 13 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx2 4 NULL 2 100.00 Using index condition; Using where EXPLAIN SELECT * FROM t1 WHERE 3 BETWEEN b AND c; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx2 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 100.00 Using sort_union(idx1,idx2); Using where EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref PRIMARY PRIMARY 20 const 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 20 const 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range dateval dateval 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range dateval dateval 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 35 NULL 3 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 35 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref a a 5 const 503 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 5 const 503 50.30 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 2 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 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 3 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 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 2 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 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 2 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 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 10 NULL 49 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 10 NULL 49 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 10 NULL 49 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 10 NULL 49 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range a a 5 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range a a 5 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -X X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +X X X X range a a X 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 partitions type possible_keys key key_len ref rows Extra -X X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +X X X X range a a X 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 partitions type possible_keys key key_len ref rows Extra -X X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +X X X X range a a X 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 partitions type possible_keys key key_len ref rows Extra -X X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +X X X X range a a X 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 partitions type possible_keys key key_len ref rows Extra -@ @ @ @ range @ @ @ @ @ @ +id select_type table partitions type possible_keys key key_len ref rows filtered 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL c_key NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL c_key NULL NULL NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL i4_uq NULL NULL NULL 8 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL i4_uq NULL NULL NULL 8 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 64 100.00 +1 SIMPLE t1 NULL range i1,i2 i1 4 NULL 12 89.45 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 64 100.00 +1 SIMPLE t1 NULL range i1,i2 i1 4 NULL 12 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 5 NULL 2 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 idx 5 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t100 NULL range I I 10 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t100 NULL range I I 10 NULL 3 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ix_fd ix_fd 63 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 4 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index b b 67 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b b 67 NULL 5 100.00 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 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) +id select_type 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 b NULL NULL NULL 5 100.00 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 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) +id select_type 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 b NULL NULL NULL 5 100.00 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 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) +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 a NULL NULL NULL 1000 100.00 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 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) +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 a NULL NULL NULL 1000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2 NULL range a a 5 NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2 NULL range a a 5 NULL 1 100.00 Using where; Using index drop table t1,t2,t3; # # MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 2 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 2 100.00 Using index condition EXPLAIN SELECT * FROM t1 WHERE 10<>a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 100.00 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 10 NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 10 NULL 6 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 5 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 5 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range|filter idx1,idx2 idx1|idx2 5|5 NULL 3 (60%) 60.00 Using index condition; Using where; Using rowid filter +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range|filter idx1,idx2 idx1|idx2 5|5 NULL 8 (14%) 14.42 Using index condition; Using where; Using rowid filter +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range|filter idx1,idx2 idx1|idx2 5|5 NULL 7 (7%) 6.73 Using index condition; Using where; Using rowid filter +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx3 idx3 10 NULL 5 100.00 Using index condition; Using where +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 15 100.00 Using index condition +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 144 100.00 Using where +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 12 100.00 Using index condition; Using where +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 NULL range idx idx 5 NULL 12 100.00 Using index condition; Using where +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 100.00 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 5 NULL 7 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 7 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 5 NULL 5 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL a NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1000 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 10 100.00 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 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) +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 PRIMARY,v NULL NULL NULL 8 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition +1 PRIMARY t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.subset_id 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.subset_id 10 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 1000 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range id id 5 NULL 3 100.00 Using index condition +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 4 100.00 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 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 +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 100.00 +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ten NULL ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using where +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +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 100.00 +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 Using where +1 SIMPLE ten NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1000 100.00 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 9 NULL 4 100.00 Using index condition +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1,t1_subset_id key1 9 NULL 3 100.00 Using where; Using index +1 SIMPLE t2 NULL ref id id 4 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 74 100.00 Using index condition; Using where +1 SIMPLE t2 NULL ref id id 5 test.t1.id 2 100.00 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 diff --git a/mysql-test/main/range_debug.result b/mysql-test/main/range_debug.result index 87a0edef744..2f92a6b66cd 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index a a 5 NULL 1003 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index a a 5 NULL 1003 100.00 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 7231ff2c3ce..640cd24edff 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 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) +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 +1 SIMPLE t2 NULL range a,b b 5 NULL 201 100.00 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 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) +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 ref PRIMARY,idx1,idx2 idx1 5 const 3 100.00 Using index condition +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 1 FLTRD 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; @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY,a PRIMARY 4 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,a PRIMARY 4 NULL 1 100.00 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 2adaf0417ad..0f4f394628a 100644 --- a/mysql-test/main/range_innodb.test +++ b/mysql-test/main/range_innodb.test @@ -108,6 +108,7 @@ select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a 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"; +--replace_column 11 FLTRD explain select * from t1 where a=10 and b=10; --error ER_TABLE_DEF_CHANGED select * from t1 where a=10 and b=10; diff --git a/mysql-test/main/range_mrr_icp.result b/mysql-test/main/range_mrr_icp.result index 766f3e7b318..f7570f58f65 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 partitions type possible_keys key key_len ref rows 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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref y y 5 const 1 100.00 +1 SIMPLE t2 NULL range x x 5 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref x x 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref x x 5 const 1 100.00 Using index explain select count(*) from t1 where x in (1,2,3,4); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range x x 5 NULL 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref j1 j1 4 const 1 100.00 Using index +1 SIMPLE t1 NULL range i1 i1 4 NULL 7 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref j1 j1 4 const 1 100.00 Using index +1 SIMPLE t1 NULL range i1 i1 4 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a,b a 5 NULL 2 40.54 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 111 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 100.00 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 111 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 100.00 explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 112 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 100.00 explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uid_index uid_index 4 NULL 112 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref uid_index uid_index 4 test.t1.uid 38 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index t1i t1i 9 NULL 2 100.00 Using where; Using index select * from t1 where a > -1; a 18446744073709551614 18446744073709551615 explain select * from t1 where a < -1; -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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 11 const 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 11 const 2 100.00 Using index condition explain select * from t1 where a=binary 'aaa'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 11 const 2 100.00 Using index condition explain select * from t1 where a='aaa' collate latin1_bin; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 11 const 2 100.00 Using index condition explain select * from t1 where a='aaa' collate latin1_german1_ci; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 2 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 2 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE v NULL ALL OXLEFT,OXRIGHT,OXROOTID NULL NULL NULL 12 50.00 Using where +1 SIMPLE s NULL ALL OXLEFT NULL NULL NULL 12 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 100.00 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE status NOT IN ('A','B'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range status status 23 NULL 18 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 100.00 Using where; Using index EXPLAIN SELECT status FROM t1 WHERE status NOT IN ('A','B'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 18 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE status NOT BETWEEN 'A' AND 'B'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 17 100.00 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE status < 'A' OR status > 'B'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range status status 23 NULL 17 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 3 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 EXPLAIN SELECT a,b FROM v1 WHERE a < 2 and b=3; -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 +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 EXPLAIN SELECT a,b FROM t1 WHERE a < 2; -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 +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 EXPLAIN SELECT a,b FROM v1 WHERE a < 2; -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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 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 8 NULL # 100.00 Using where; Using index explain select * from v1 where a in (3,4) and b in (1,2,3); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 100.00 Using where; Using index explain select * from t1 where a between 3 and 4 and b between 1 and 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 100.00 Using where; Using index explain select * from v1 where a between 3 and 4 and b between 1 and 2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 8 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL # 100.00 Using index condition; Rowid-ordered scan explain select * from t1 where a = 'a' or a='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL # 100.00 Using index condition; Rowid-ordered scan explain select * from t2 where a between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 13 const # 100.00 Using index condition explain select * from t2 where a = 'a' or a='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 13 const # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 13 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx2 4 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE 3 BETWEEN b AND c; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx2 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 100.00 Using sort_union(idx1,idx2); Using where EXPLAIN SELECT * FROM t1 WHERE 0 NOT BETWEEN b AND c; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge idx1,idx2 idx1,idx2 4,4 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref PRIMARY PRIMARY 20 const 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref PRIMARY PRIMARY 20 const 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range dateval dateval 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 35 NULL 3 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 35 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref a a 5 const 503 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref a a 5 const 503 50.30 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 2 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 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 3 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 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 2 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 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 2 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 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 10 NULL 49 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 10 NULL 49 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range a a 10 NULL 49 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 10 NULL 49 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range a a 5 NULL 9 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range a a 5 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -X X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +X X X X range a a X 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 partitions type possible_keys key key_len ref rows Extra -X X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +X X X X range a a X 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 partitions type possible_keys key key_len ref rows Extra -X X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +X X X X range a a X 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 partitions type possible_keys key key_len ref rows Extra -X X X X range a a X X X X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +X X X X range a a X 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 partitions type possible_keys key key_len ref rows Extra -@ @ @ @ range @ @ @ @ @ @ +id select_type table partitions type possible_keys key key_len ref rows filtered 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL c_key NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL c_key NULL NULL NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const i4_uq i4_uq 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 8 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range i4_uq i4_uq 5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL i4_uq NULL NULL NULL 8 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL i4_uq NULL NULL NULL 8 100.00 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.i4 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 64 100.00 +1 SIMPLE t1 NULL range i1,i2 i1 4 NULL 12 89.45 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 64 100.00 +1 SIMPLE t1 NULL range i1,i2 i1 4 NULL 12 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 5 NULL 2 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 idx 5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t100 NULL range I I 10 NULL 3 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index ix_fd ix_fd 63 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 4 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index b b 67 NULL 5 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b b 67 NULL 5 100.00 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 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) +id select_type 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 b NULL NULL NULL 5 100.00 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 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) +id select_type 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 b NULL NULL NULL 5 100.00 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 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) +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 a NULL NULL NULL 1000 100.00 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 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) +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 a NULL NULL NULL 1000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2 NULL range a a 5 NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t2 NULL range a a 5 NULL 1 100.00 Using where; Using index drop table t1,t2,t3; # # MDEV-6480: Remove conditions for which range optimizer returned SEL_ARG::IMPOSSIBLE. @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 100.00 Using index condition; Rowid-ordered scan EXPLAIN SELECT * FROM t1 WHERE 10<>a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 2 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 10 NULL 6 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx1,idx2 idx1 5 NULL 3 60.00 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx1,idx2 idx1 5 NULL 8 14.42 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx1,idx2 idx1 5 NULL 7 6.73 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range idx3 idx3 10 NULL 5 100.00 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t1 NULL ref idx idx 5 test.t2.d 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 15 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 144 100.00 Using where +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 12 100.00 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 NULL range idx idx 5 NULL 12 100.00 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL ref idx3 idx3 5 test.t1.a 3 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL a NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1,idx2 idx1 5 NULL 11 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1000 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 1000 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 10 100.00 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 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) +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 PRIMARY,v NULL NULL NULL 8 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.subset_id 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY <derived2> NULL ref key0 key0 5 test.t1.subset_id 10 100.00 +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 1000 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range id id 5 NULL 3 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 4 100.00 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 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 +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 100.00 +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ten NULL ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using where; Rowid-ordered scan +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +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 100.00 +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 Using where +1 SIMPLE ten NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range t1_subset_id t1_subset_id 5 NULL 3 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1000 100.00 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 9 NULL 4 100.00 Using index condition; Rowid-ordered scan +1 SIMPLE t2 NULL ref id id 5 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1,t1_subset_id key1 9 NULL 3 100.00 Using where; Using index +1 SIMPLE t2 NULL ref id id 4 test.t1.subset_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 74 100.00 Using index condition; Using where +1 SIMPLE t2 NULL ref id id 5 test.t1.id 2 100.00 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 diff --git a/mysql-test/main/range_notembedded.result b/mysql-test/main/range_notembedded.result index 0a94dec1c09..2df092cd3c0 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range PRIMARY,key1 key1 5 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range PRIMARY,key1 key1 5 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index key1 key1 20 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index key1 key1 20 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index key1 key1 20 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index key1 key1 20 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index key1 key1 20 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index key1 key1 20 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 2 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 2 NULL 3 100.00 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 c9704ab90bc..6276982f682 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL ALL Population,Name NULL NULL NULL 4079 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Population,Name NULL NULL NULL 4079 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country,Name Country 3 NULL 104 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Name Name 35 NULL 135 59.38 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,PRIMARY,Country 35,4,3 NULL 30 100.00 Using sort_union(Name,PRIMARY,Country); Using where EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 115000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 459 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 102000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Country,Name Name,Country 35,3 NULL 172 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Country 35,3 NULL 172 11.25 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country,Name Population 4 NULL 39 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Name Name 35 NULL 13 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 13 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Name < 'Bb'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 207 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Country > 'A' AND Country < 'B'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country Country 3 NULL 104 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 39 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 221 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 110000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 328 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 103000 AND Population < 104000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 37 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country,Name Name 35 NULL 52 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Population 35,4 NULL 50 5.74 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Country,Name 3,35 NULL 143 6.03 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Country,Population 3,4 NULL 141 10.49 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 20 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 20 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 200 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL PRIMARY NULL NULL NULL 4079 29.42 Using where EXPLAIN SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country Country 3 NULL 20 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 223 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 72 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,Country,Population 35,3,4 NULL 151 34.32 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,Country,Population 35,3,4 NULL 124 4.90 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Population Population 4 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Population > 101000 AND Population < 110000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 328 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country < 'C'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country Country 3 NULL 435 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country < 'AGO'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country Country 3 NULL 5 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 221 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 39 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 401 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'P%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 135 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Country,Name,Population 3,35,4 NULL 83 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Country,Name,PRIMARY 3,35,4 NULL 55 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Name Name 35 NULL 4 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 4 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'P%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 135 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 103000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 81 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country='USA'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation Country 3 const 267 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country='FIN'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation Country 3 const 7 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%') AND Country='USA'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name,CountryPopulation CountryPopulation,Name 7,35 NULL 14 6.55 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Population,Country,Name,CountryPopulation Country 3 const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName Country 3 const 267 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country='FIN'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName CountryName 3 const 5 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country='BRA'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName CountryName 3 const 221 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 5 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 301 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 80 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 250 and 260 ; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 102000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 103000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 81 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'Pa%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 41 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY 7,4 NULL 14 6.55 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName,PRIMARY 38,4 NULL 11 6.55 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 3 const 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY,CountryName 7,4,38 NULL 35 12.53 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range|filter PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName|PRIMARY 38|4 NULL 23 (7%) 0.62 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name,CountryPopulation,CountryName Name 35 NULL 1 7.38 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 10 6.55 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 10 6.55 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName,CityName CountryName,CityName 38,35 NULL 28 0.69 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 28 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Country,Name,Population Name,Country 35,3 NULL # 15.69 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # 8.29 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # 52.81 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 99.87 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 12,12 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 14,14 NULL 2 0.03 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 14,14 NULL 2 0.03 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 21,21 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2,k3 k1,k2 21,21 NULL 2 93.70 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge c1,c2 c1,c2 13,16 NULL 2 100.00 Using union(c1,c2); Using where explain select * from t1 where (c1=' 100000' or c2=' 2000000') and c3='2'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge c1,c2,c3 c1,c2 13,16 NULL 2 50.37 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,idx1,idx2,idx3 idx3,idx2,PRIMARY,idx1 67,13,4,3 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 306 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 306 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 320 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 320 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 f3,PRIMARY,f3 5,4,5 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 55.56 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 55.56 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,idx PRIMARY 4 NULL 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY,idx NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range state,capital state 71 NULL 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range CountryName,Name CountryName 38 NULL 20 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range CountryName,Name CountryName 38 NULL 20 100.00 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_innodb.result b/mysql-test/main/range_vs_index_merge_innodb.result index d5312131345..ec016c727df 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL ALL Population,Name NULL NULL NULL 4079 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ALL Population,Name NULL NULL NULL 4079 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country,Name Country 3 NULL 106 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Name Name 35 NULL 236 59.40 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 35,3,4 NULL 32 100.00 Using sort_union(Name,Country,PRIMARY); Using where EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 115000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 459 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 102000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'F')); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Country,Name Name,Country 35,3 NULL 215 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Country 35,3 NULL 215 11.25 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country,Name Population 4 NULL 39 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Name Name 35 NULL 23 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 23 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Name < 'Bb'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 374 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Country > 'A' AND Country < 'B'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country Country 3 NULL 107 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'Pb'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 71 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Name BETWEEN 'P' AND 'S'); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 385 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 110000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 328 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 103000 AND Population < 104000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 37 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population,Country,Name Name 35 NULL 94 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Name,Population 35,4 NULL 60 10.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Country,Name 3,35 NULL 178 10.91 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name Country,Population 3,4 NULL 144 18.61 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 20 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 20 100.00 Using where EXPLAIN SELECT * FROM City WHERE (ID < 200) OR (ID BETWEEN 100 AND 200); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 200 100.00 Using where EXPLAIN SELECT * FROM City WHERE (ID < 600) OR (ID BETWEEN 900 AND 1500); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 1200 100.00 Using where EXPLAIN SELECT * FROM City WHERE Country > 'A' AND Country < 'ARG'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country Country 3 NULL 20 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'H%' OR Name LIKE 'P%' ; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 395 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'Ha%' OR Name LIKE 'Pa%' ; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 133 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name PRIMARY 4 NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Name,Country,PRIMARY 39,3,4 NULL 683 34.32 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name PRIMARY 4 NULL 200 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Population Population 4 NULL 39 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Population > 101000 AND Population < 110000; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 328 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country < 'C'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country Country 3 NULL 446 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country < 'AGO'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country Country 3 NULL 5 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'P' AND 'S'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 385 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name BETWEEN 'P' AND 'Pb'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 71 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3400 AND 3800; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 401 100.00 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 100.00 Using where EXPLAIN SELECT * FROM City WHERE Name LIKE 'P%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 236 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Population,PRIMARY 4,4 NULL 440 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name Country,Name,PRIMARY 3,35,4 NULL 87 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Name Name 35 NULL 8 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 8 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'P%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 236 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 103000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 81 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country='USA'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation Country 3 const 274 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country='FIN'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation Country 3 const 7 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ((Population > 101000 AND Population < 103000) OR Name LIKE 'Pas%') AND Country='USA'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Population,Country,Name,CountryPopulation CountryPopulation,Name 7,35 NULL 18 6.72 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Population,Country,Name,CountryPopulation Country 3 const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName Country 3 const 274 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country='FIN'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName Country 3 const 7 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Country='BRA'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName Country 3 const 250 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3790 AND 3800; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 100.00 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4025 AND 4035; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 100.00 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4028 AND 4032; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 5 100.00 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 3500 AND 3800; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 301 100.00 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 4000 AND 4300; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 80 100.00 Using where EXPLAIN SELECT * FROM City WHERE ID BETWEEN 250 and 260 ; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY PRIMARY 4 NULL 11 100.00 Using where EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 102000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 39 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE (Population > 101000 AND Population < 103000); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Population Population 4 NULL 81 100.00 Using index condition EXPLAIN SELECT * FROM City WHERE Name LIKE 'Pa%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Name Name 35 NULL 71 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,PRIMARY 7,4 NULL 14 6.72 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName,PRIMARY 38,4 NULL 10 6.72 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref PRIMARY,Population,Country,Name,CountryPopulation,CountryName Country 3 const 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryPopulation,CountryName,PRIMARY 7,38,4 NULL 36 12.85 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name,CountryPopulation,CountryName CountryName 38 NULL 18 0.48 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range PRIMARY,Population,Country,Name,CountryPopulation,CountryName Name 35 NULL 1 7.38 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 8 6.72 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Country,CountryPopulation,CountryName CountryPopulation,CountryName 7,38 NULL 8 6.72 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL index_merge Country,Name,Population Name,Country 35,3 NULL # 15.69 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # 9.44 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # 60.16 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range Country,Name,Population Population 4 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 12,12 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 14,14 NULL 2 0.03 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 14,14 NULL 2 0.03 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2 k1,k2 21,21 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge k1,k2,k3 k1,k2 21,21 NULL 2 93.73 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge c1,c2 c1,c2 13,16 NULL 2 100.00 Using union(c1,c2); Using where explain select * from t1 where (c1=' 100000' or c2=' 2000000') and c3='2'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge c1,c2,c3 c1,c2 13,16 NULL 2 50.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,idx1,idx2,idx3 idx3,idx2,idx1,PRIMARY 67,13,3,4 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 306 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 306 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 PRIMARY,f3 4,5 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 320 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,f3,f4 NULL NULL NULL 320 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge PRIMARY,f3,f4 PRIMARY,f3 4,5 NULL 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 55.56 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY,idx1,idx2 NULL NULL NULL 9 55.56 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY,idx idx 5 NULL 2 50.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY,idx idx 5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range state,capital state 71 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL range CountryName,Name Name 35 NULL 20 100.00 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 6252684c0a0..85826a21446 100644 --- a/mysql-test/main/row.result +++ b/mysql-test/main/row.result @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 8 const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 8 const,const 1 100.00 Using index EXPLAIN SELECT * FROM t1 WHERE (a,b)=(3,2); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 8 const,const 1 100.00 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 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 +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 8 test.t1.a,test.t1.b 1 100.00 Using index EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b); -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 +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 8 test.t1.a,test.t1.b 1 100.00 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 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 +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 where; Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,2); -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 +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 where; Using index +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 @@ -415,19 +415,19 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 const,const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 const,const 1 100.00 Using index EXPLAIN SELECT * FROM t2 WHERE (a,b)=(3,2); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref PRIMARY PRIMARY 8 const,const 1 100.00 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 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 +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 EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1)); 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 diff --git a/mysql-test/main/rowid_filter.result b/mysql-test/main/rowid_filter.result index bf572cf909d..d6cbe176188 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 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 +id select_type table partitions type possible_keys key key_len ref rows 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%) 11.69 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; @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 509 11.69 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; @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 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%) 4.60 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 100.00 Using index condition +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 4.60 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows 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%) 11.69 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%) 9.27 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows 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 11.69 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 9.27 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 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%) 8.48 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 69 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 8.48 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows 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 0.57 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 7.47 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows 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 0.57 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 7.47 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 3.20 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 3.05 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 3.20 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 3.05 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 1.95 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 3.05 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 39 1.95 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 3.05 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range el_index,el_index_60 el_index 62 NULL 645 7.98 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter a,b b|a 5|5 const 2 (14%) 14.29 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_innodb.result b/mysql-test/main/rowid_filter_innodb.result index 9595a3d440f..0a895b1ae31 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 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 +id select_type table partitions type possible_keys key key_len ref rows 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%) 10.07 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; @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range i_l_shipdate,i_l_quantity i_l_shipdate 4 NULL 510 10.07 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; @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 100.00 Using where; Using index +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 4.73 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE lineitem NULL range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 100.00 Using where; Using index +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 4.73 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows 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%) 10.07 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 9.60 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 144 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 0.86 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 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 8.49 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice i_o_totalprice 9 NULL 71 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 8.49 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows 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 0.57 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 5.67 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows 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 0.57 Using index condition; Using where +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 5.67 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 3.33 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 3.05 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 3.33 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 3.05 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 2.07 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 3.05 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL range PRIMARY,i_o_orderdate,i_o_totalprice,i_o_totaldiscount i_o_totaldiscount 9 NULL 41 2.07 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 3.05 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range el_index,el_index_60 el_index 62 NULL 1000 10.01 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter a,b b|a 5|5 const 2 (14%) 14.29 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref|filter f1,f2 f1|f1 13|13 const 1 (2%) 1.59 Using index condition; Using where; Using rowid filter +2 UNION t1 NULL ref|filter f1,f2 f1|f1 13|13 const 1 (2%) 1.59 Using index condition; Using where; Using rowid filter +NULL UNION RESULT <union1,2> NULL ALL NULL 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 diff --git a/mysql-test/main/rowid_filter_innodb_debug.result b/mysql-test/main/rowid_filter_innodb_debug.result index aad0bd4ea45..785dde20ea2 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 SIMPLE t3 NULL ref|filter key1,key2 key1|key2 5|5 test.t2.a 1000 (20%) 20.00 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 1d2326a4dcd..853dde14795 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 SIMPLE t3 NULL ref|filter key1,key2 key1|key2 5|5 test.t2.a 1000 (18%) 18.42 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 6c5e6fde3bf..38fd97615fb 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge key1,key2 key1,key2 5,5 NULL 5 100.00 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 8114c5e46d6..ec11266fe97 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 3 100.00 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 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 +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; Using temporary; Using filesort select *,rownum() from t1,t2; a b a b rownum() 1 10 2 21 1 diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result index 3004c3c941a..6fb2feaac14 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 100.00 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 100.00 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 100.00 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -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 +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 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 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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 100.00 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 @@ -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 partitions type possible_keys key key_len ref rows 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 explain select fld3 from t2 where fld1=fld1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 +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 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 t4 NULL const id4 NULL NULL NULL 1 100.00 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 100.00 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 100.00 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 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 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 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 +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 ref a a 23 test.t1.a 2 100.00 Using where EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; -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 +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 ref a a 23 test.t1.a 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index t2i t2i 2 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index t2i t2i 2 NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b,c b 5 const 1 100.00 Using temporary; Using filesort +1 SIMPLE t3 NULL index PRIMARY,a,b PRIMARY 8 NULL 2 100.00 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select max(key2) from t2 where key2 <= 1.6158; -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 +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 explain select min(key1) from t1 where key1 >= 0.3762; -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 +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 explain select min(key2) from t2 where key2 >= 1.3762; -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 +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 explain select max(key1), min(key2) from t1, t2 where key1 <= 0.6158 and key2 >= 1.3762; -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 +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 explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 100.00 Using where; Using index explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 100.00 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 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) +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 3 100.00 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 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) +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 5 100.00 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 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 +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 const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 100.00 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 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 +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 const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL range PRIMARY PRIMARY 12 NULL 4 30.00 Using index condition; Using where +1 SIMPLE B NULL ref PRIMARY PRIMARY 8 const,test.A.e 10 90.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 100.00 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) 30.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 83.33 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) 30.00 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 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 +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 ref idx idx 4 const 8 100.00 Using index EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=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 ref idx idx 4 const 1 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 ref idx idx 4 const 1 100.00 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 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 +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 idx1 NULL NULL NULL 1 100.00 +1 SIMPLE t3 NULL ref idx1 idx1 5 const 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +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 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 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 +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 range si si 5 NULL 4 100.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) 30.00 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 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 +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 range si,ai si 5 NULL 4 100.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) 30.00 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 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 +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 range si si 5 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) 30.00 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 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 +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 range si,ai si 5 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) 30.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 98.46 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 98.46 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) 5.79 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 26.86 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 65.29 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) 7.44 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 35.95 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 54.13 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx1|idx2 5|4 const 2 (1%) 0.01 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 NULL range ts ts 4 NULL 2 50.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref name name 6 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 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 +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 ref name name 6 test.t1.name 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref name name 6 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 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 +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 ref name name 6 test.t1.name 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE f1 NULL range inx inx 5 NULL 7 100.00 Using where; Using index +1 SIMPLE f2 NULL ref inx inx 5 test.f1.b 1 100.00 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 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 +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 +31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +32 DEPENDENT SUBQUERY NULL 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; @@ -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 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) +id select_type 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 a NULL NULL NULL 2 100.00 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 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) +id select_type 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 a NULL NULL NULL 2 100.00 Range checked for each record (index map: 0x1) SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a); 1 1 @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 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 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 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 24492 100.00 Using filesort SELECT * FROM t1 ORDER BY c, a LIMIT 5; a b c 0 @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 100.00 +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 100.00 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 100.00 EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t1.a1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 100.00 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 100.00 EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t2.a2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 100.00 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL system PRIMARY,f32 NULL NULL NULL 1 100.00 +1 SIMPLE t5 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t2 NULL ref f22 f22 5 const 1 100.00 +1 SIMPLE t4 NULL ref f42 f42 5 const 1 100.00 Using index +1 SIMPLE t6 NULL ref f61 f61 5 const 1 100.00 Using where +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE CC NULL range int_key int_key 4 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 DROP TABLE t1; # # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on diff --git a/mysql-test/main/select_debug.result b/mysql-test/main/select_debug.result index 469951e9d2b..cfeb5b75659 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 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) +id select_type 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 hash_ALL NULL #hash#$hj 5 test.t1.b 2 100.00 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 ee305498682..ac6d17c2cad 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY,kid NULL NULL NULL 0 0.00 Const row not found; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 200 100.00 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 270f5555d9c..88f98ecf1b9 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 100.00 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 100.00 Using temporary; Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL period NULL NULL NULL 41810 100.00 Using temporary; Using filesort +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 100.00 Using temporary; Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 100.00 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1200 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -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 +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 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 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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 test.t4.companynr 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 100.00 Using index; Using temporary +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 1 func 1199 100.00 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 @@ -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 partitions type possible_keys key key_len ref rows 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 explain select fld3 from t2 where fld1=fld1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 +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 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 partitions type possible_keys key key_len ref rows 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 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 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) +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 t4 NULL const id4 NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t2 NULL hash_ALL NULL #hash#$hj 4 test.t1.id1 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 100.00 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 100.00 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 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 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 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 +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 ref a a 23 test.t1.a 2 100.00 Using where EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; -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 +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 ref a a 23 test.t1.a 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index t2i t2i 2 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index t2i t2i 2 NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b,c b 5 const 1 100.00 Using temporary; Using filesort +1 SIMPLE t3 NULL index PRIMARY,a,b PRIMARY 8 NULL 2 100.00 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select max(key2) from t2 where key2 <= 1.6158; -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 +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 explain select min(key1) from t1 where key1 >= 0.3762; -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 +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 explain select min(key2) from t2 where key2 >= 1.3762; -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 +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 explain select max(key1), min(key2) from t1, t2 where key1 <= 0.6158 and key2 >= 1.3762; -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 +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 explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 100.00 Using where; Using index explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 100.00 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 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) +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 hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 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 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) +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 Using where +1 SIMPLE t1 NULL hash_ALL NULL #hash#$hj 5 test.t2.a 5 100.00 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 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 +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 const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 100.00 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 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 +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 const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL range PRIMARY PRIMARY 12 NULL 4 30.00 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE B NULL ref PRIMARY PRIMARY 8 const,test.A.e 10 90.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 100.00 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) 30.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 83.33 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) 30.00 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 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 +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 ref idx idx 4 const 8 100.00 Using index EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=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 ref idx idx 4 const 1 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 ref idx idx 4 const 1 100.00 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 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 +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 idx1 NULL NULL NULL 1 100.00 +1 SIMPLE t3 NULL ref idx1 idx1 5 const 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 100.00 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +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 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 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 +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 range si si 5 NULL 4 100.00 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%) 30.00 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 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 +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 range si,ai si 5 NULL 4 100.00 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%) 30.00 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 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 +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 range si si 5 NULL 2 100.00 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%) 30.00 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 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 +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 range si,ai si 5 NULL 2 100.00 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%) 30.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 98.46 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 98.46 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) 5.79 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 26.86 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 65.29 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) 7.44 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 35.95 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 54.13 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx1|idx2 5|4 const 2 (1%) 0.01 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 NULL range ts ts 4 NULL 2 50.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref name name 6 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 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 +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 ref name name 6 test.t1.name 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref name name 6 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 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 +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 ref name name 6 test.t1.name 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE f1 NULL range inx inx 5 NULL 7 100.00 Using where; Using index +1 SIMPLE f2 NULL ref inx inx 5 test.f1.b 1 100.00 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 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 +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 +31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +32 DEPENDENT SUBQUERY NULL 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; @@ -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 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) +id select_type 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 a #hash#$hj 6 test.t1.a 2 100.00 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 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) +id select_type 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 a #hash#$hj 6 test.t1.a 2 100.00 Using where; Using join buffer (flat, BNLH join) SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a); 1 1 @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 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 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 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 24492 100.00 Using filesort SELECT * FROM t1 ORDER BY c, a LIMIT 5; a b c 0 @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 100.00 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL system PRIMARY,f32 NULL NULL NULL 1 100.00 +1 SIMPLE t5 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t2 NULL ref f22 f22 5 const 1 100.00 +1 SIMPLE t4 NULL ref f42 f42 5 const 1 100.00 Using index +1 SIMPLE t6 NULL ref f61 f61 5 const 1 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE CC NULL range int_key int_key 4 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 DROP TABLE t1; # # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result index 3004c3c941a..6fb2feaac14 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 100.00 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 100.00 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 100.00 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -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 +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 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 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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 100.00 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 @@ -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 partitions type possible_keys key key_len ref rows 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 explain select fld3 from t2 where fld1=fld1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 +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 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 t4 NULL const id4 NULL NULL NULL 1 100.00 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 100.00 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c,d d 5 const 2 100.00 +1 SIMPLE t1 NULL ALL a NULL NULL NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 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 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 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 +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 ref a a 23 test.t1.a 2 100.00 Using where EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a; -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 +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 ref a a 23 test.t1.a 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index t2i t2i 2 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index t2i t2i 2 NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b,c b 5 const 1 100.00 Using temporary; Using filesort +1 SIMPLE t3 NULL index PRIMARY,a,b PRIMARY 8 NULL 2 100.00 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index b b 5 NULL 2 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select max(key2) from t2 where key2 <= 1.6158; -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 +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 explain select min(key1) from t1 where key1 >= 0.3762; -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 +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 explain select min(key2) from t2 where key2 >= 1.3762; -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 +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 explain select max(key1), min(key2) from t1, t2 where key1 <= 0.6158 and key2 >= 1.3762; -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 +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 explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 100.00 Using where; Using index explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 3 100.00 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 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) +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 3 100.00 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 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) +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 5 100.00 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 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 +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 const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 100.00 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 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 +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 const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t3 NULL const PRIMARY PRIMARY 8 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL range PRIMARY PRIMARY 12 NULL 4 30.00 Using index condition; Using where +1 SIMPLE B NULL ref PRIMARY PRIMARY 8 const,test.A.e 10 90.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 100.00 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) 30.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL c NULL NULL NULL 18 83.33 Using where +1 SIMPLE t1 NULL eq_ref|filter PRIMARY,b PRIMARY|b 4|5 test.t2.c 1 (30%) 30.00 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 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 +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 ref idx idx 4 const 8 100.00 Using index EXPLAIN SELECT b FROM t1, t2 WHERE b=c AND a=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 ref idx idx 4 const 1 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 ref idx idx 4 const 1 100.00 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 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 +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 idx1 NULL NULL NULL 1 100.00 +1 SIMPLE t3 NULL ref idx1 idx1 5 const 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 12 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 18 test.t1.fk 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 +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 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 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 +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 range si si 5 NULL 4 100.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) 30.00 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 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 +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 range si,ai si 5 NULL 4 100.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) 30.00 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 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 +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 range si si 5 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) 30.00 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 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 +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 range si,ai si 5 NULL 2 100.00 Using index condition; Using where +1 SIMPLE t3 NULL eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) 30.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 98.46 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 1 98.46 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (6%) 5.79 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 26.86 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 65.29 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx2|idx1 4|10 const 2 (7%) 7.44 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 35.95 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx1,idx2 idx2 4 const 2 54.13 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref|filter idx1,idx2 idx1|idx2 5|4 const 2 (1%) 0.01 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 SIMPLE t1 NULL range ts ts 4 NULL 2 50.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref name name 6 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 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 +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 ref name name 6 test.t1.name 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref name name 6 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref name name 6 const 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range name name 6 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range name name 6 NULL 4 100.00 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 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 +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 ref name name 6 test.t1.name 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE f1 NULL range inx inx 5 NULL 7 100.00 Using where; Using index +1 SIMPLE f2 NULL ref inx inx 5 test.f1.b 1 100.00 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 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 +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 +31 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +32 DEPENDENT SUBQUERY NULL 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; @@ -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 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) +id select_type 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 a NULL NULL NULL 2 100.00 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 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) +id select_type 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 a NULL NULL NULL 2 100.00 Range checked for each record (index map: 0x1) SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a); 1 1 @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 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 24492 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 24492 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 24492 100.00 Using filesort SELECT * FROM t1 ORDER BY c, a LIMIT 5; a b c 0 @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.f1 1 100.00 +1 SIMPLE t5 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +1 SIMPLE t6 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 100.00 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 100.00 EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t1.a1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 100.00 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 100.00 EXPLAIN SELECT * FROM t1,t2,t3 WHERE t2.a2=t1.a1 AND t3.a3=t2.a2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL idx NULL NULL NULL 3 100.00 +1 SIMPLE t2 NULL ref idx idx 4 test.t1.a1 2 100.00 +1 SIMPLE t3 NULL ref idx idx 4 test.t1.a1 5 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL system PRIMARY,f32 NULL NULL NULL 1 100.00 +1 SIMPLE t5 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 SIMPLE t2 NULL ref f22 f22 5 const 1 100.00 +1 SIMPLE t4 NULL ref f42 f42 5 const 1 100.00 Using index +1 SIMPLE t6 NULL ref f61 f61 5 const 1 100.00 Using where +1 SIMPLE t7 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE CC NULL range int_key int_key 4 NULL 9 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 DROP TABLE t1; # # Bug#54515: Crash in opt_range.cc::get_best_group_min_max on diff --git a/mysql-test/main/select_safe.result b/mysql-test/main/select_safe.result index 06f6a67e09d..4ef88f54747 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL b NULL NULL NULL 11 100.00 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 11 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL b NULL NULL NULL 11 100.00 +1 SIMPLE t2 NULL ALL b NULL NULL NULL 11 100.00 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 e9d410cccad..e984e70e8b8 100644 --- a/mysql-test/main/selectivity.result +++ b/mysql-test/main/selectivity.result @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE City NULL ref Country,CountryPopulation,CountryName CountryName 3 const 5 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range b,b_2 b 4 NULL 226 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b,b_2 b 4 NULL 226 98.23 Using where SELECT a FROM t1 WHERE b = 1 ORDER BY c DESC LIMIT 9; a 2071 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +2 DEPENDENT SUBQUERY A NULL ref PRIMARY,a a 5 test.t1.a 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL ref|filter a,b a|b 5|5 test.A.id 1 (10%) 10.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL const PRIMARY,a PRIMARY 4 const 1 100.00 +1 SIMPLE B NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +2 DEPENDENT SUBQUERY A NULL ref PRIMARY,a a 5 test.t1.a 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL ref|filter a,b a|b 5|5 test.A.id 1 (10%) 10.00 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; diff --git a/mysql-test/main/selectivity_no_engine.result b/mysql-test/main/selectivity_no_engine.result index f0e18ff1df0..ea01a139122 100644 --- a/mysql-test/main/selectivity_no_engine.result +++ b/mysql-test/main/selectivity_no_engine.result @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref f1 f1 325 const,const 2 100.00 Using index condition; Using where +1 SIMPLE t1 NULL eq_ref PRIMARY PRIMARY 122 test.t2.t1_id 1 100.00 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 @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE a NULL ALL NULL NULL NULL NULL 5 100.00 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 100.00 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 ae4087bc1c9..06077cb4531 100644 --- a/mysql-test/main/set_operation.result +++ b/mysql-test/main/set_operation.result @@ -523,24 +523,24 @@ UNION ALL select * from v0 where g < 4 UNION ALL select * from t3; -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 +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 EXPLAIN format=json select * from t1 UNION ALL diff --git a/mysql-test/main/show_analyze_partition.result b/mysql-test/main/show_analyze_partition.result index a7234b500cd..a65d28f1a1a 100644 --- a/mysql-test/main/show_analyze_partition.result +++ b/mysql-test/main/show_analyze_partition.result @@ -25,8 +25,8 @@ 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select count(*) from t1 where a in (1,2) connection con1; diff --git a/mysql-test/main/show_explain.result b/mysql-test/main/show_explain.result index d5c2e33106f..a3c42a74d7a 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 999 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 999 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 10 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 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 10 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 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 100.00 Using index condition; Rowid-ordered scan Warnings: Note 1003 explain select max(c) from t1 where a < 10 connection con1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 100.00 Using index condition; Rowid-ordered scan Warnings: Note 1003 explain select max(c) from t1 where a < 10 connection con1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 +2 UNION B NULL ALL NULL NULL NULL NULL 10 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 +2 UNION B NULL ALL NULL NULL NULL NULL 10 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 +2 UNION B NULL ALL NULL NULL NULL NULL 10 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 +2 UNION B NULL ALL NULL NULL NULL NULL 10 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 Warnings: Note 1003 explain select a, (select max(a) from t0 B) from t0 A where a<1 connection con1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 100.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<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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 100.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<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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 100.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<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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 100.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<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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.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; @@ -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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.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; @@ -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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.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 explain for $thr2; -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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.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 explain for $thr2; -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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.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; @@ -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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.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 explain for connection $thr2; -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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.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 explain for connection $thr2; -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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.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; @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using filesort +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using filesort +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary +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 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 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) +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) 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 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) +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 alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a connection con1; @@ -535,9 +535,9 @@ 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 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) +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 EXPLAIN EXTENDED SELECT alias.a FROM t2, ( SELECT * FROM t2 ) AS alias GROUP BY alias.a connection con1; @@ -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 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 +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 t2 NULL ALL NULL NULL NULL NULL 6 100.00 +2 DERIVED t3 NULL system NULL NULL NULL NULL 1 100.00 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 * 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +2 SUBQUERY t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 +3 SUBQUERY NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +2 SUBQUERY t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 +3 SUBQUERY NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a1 5 NULL 20 100.00 Using where; Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 87 100.00 Using join buffer (flat, BNL join) +2 SUBQUERY NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL a1 5 NULL 20 100.00 Using where; Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 87 100.00 Using join buffer (flat, BNL join) +2 SUBQUERY NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery2> NULL const distinct_key distinct_key 8 const,const 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL index NULL a1 4 NULL 20 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 2 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE A NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 SIMPLE B NULL ALL key1 NULL NULL NULL 100 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE STATISTICS NULL ALL NULL TABLE_SCHEMA,TABLE_NAME NULL 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 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 +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 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 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 +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 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 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 +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 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 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 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 +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 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 a FROM t1 WHERE a IN ( SELECT 1+SLEEP(0.01) UNION SELECT 2 ) show explain for $thr2; -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 +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 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 100.00 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 20 100.00 +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 100.00 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 20 100.00 +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using temporary +1 SIMPLE t3 NULL ref a a 5 test.t1.a 7 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index; Using temporary +1 SIMPLE t3 NULL ref a a 5 test.t1.a 7 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 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 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 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 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 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 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index_merge a,b a,b 5,5 NULL 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4112 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 4112 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4112 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 4112 100.00 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 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 +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 index_subquery PRIMARY,c c 5 func 1 100.00 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 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 +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 index_subquery PRIMARY,c c 5 func 1 100.00 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 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 +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 range b b 6 NULL 107 100.00 Using where; Using index +1 SIMPLE t3 NULL ref PRIMARY PRIMARY 5 test.t1.b 1 100.00 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 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 +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 range b b 6 NULL 107 100.00 Using where; Using index +1 SIMPLE t3 NULL ref PRIMARY PRIMARY 5 test.t1.b 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 14 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 100.00 +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL 14 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 100.00 +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 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 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY t1 NULL ALL a NULL NULL NULL 2 100.00 Range checked for each record (index map: 0x1) +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY t1 NULL ALL a NULL NULL NULL 2 100.00 Range checked for each record (index map: 0x1) +4 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 fb70dab1873..aa98d512cad 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 5 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 +2 UNION B NULL ALL NULL NULL NULL NULL 10 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 +2 UNION B NULL ALL NULL NULL NULL NULL 10 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 Warnings: Note 1003 explain select a, (select max(a) from t0 B) from t0 A where a<1 connection con1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 100.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<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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY a NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY b NULL ALL NULL NULL NULL NULL 10 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using filesort +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 Using temporary +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 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 a6cf190e5a9..53d9ba9ece7 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 1 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 8 100.00 Using where +1 SIMPLE t1 NULL ref a a 5 test.t0.a 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 1 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 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 2319908b27b..559a95ff37e 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t0 NULL ALL NULL NULL NULL NULL 10 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 10 100.00 Using where Warnings: Note 1003 select count(*) from t0 where a < 100000 connection con1; diff --git a/mysql-test/main/sp-row.result b/mysql-test/main/sp-row.result index 1d590797b16..c6a86d10b21 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 partitions type possible_keys key key_len ref rows 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 # # MDEV-14139 Anchored data types for variables # diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index 76e19195ed2..0c0eea4d9db 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref c1 c1 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 100.00 Using index EXPLAIN SELECT * FROM t1 WHERE c1=f1(); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM v1 WHERE c1=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 100.00 Using index EXPLAIN SELECT * FROM v1 WHERE c1=f1(); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(10); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c1 c1 5 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c1 5 NULL 5 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE c1=f2(rand()); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c1 5 NULL 5 100.00 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 43ce06892ab..46f58ecd278 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 100.00 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 100.00 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 100.00 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -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 +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 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 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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 100.00 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 @@ -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 partitions type possible_keys key key_len ref rows 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 explain select fld3 from t2 where fld1=fld1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 +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 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 partitions type possible_keys key key_len ref rows 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 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 6ec561c741b..dd441397f8a 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -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 +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 explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 Using where; Using index explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref fld3 fld3 30 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld3 fld3 30 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range fld1 fld1 4 NULL 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL fld1 NULL NULL NULL 1199 100.00 Using where; Using temporary; Using filesort +1 SIMPLE t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.fld1 1 100.00 Using where; Using index explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL period NULL NULL NULL 41810 100.00 Using filesort +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t1 NULL ref period period 4 test.t3.period 4181 100.00 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index period period 4 NULL 1 100.00 +1 SIMPLE t3 NULL ref period period 4 test.t1.period 4181 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const fld1 fld1 4 const 1 100.00 +1 SIMPLE t3 NULL const PRIMARY,period PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1200 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr is null; -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 +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 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 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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -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 +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 +1 SIMPLE t4 NULL eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 100.00 explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 91.67 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL PRIMARY NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 12 100.00 Using where +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL index NULL PRIMARY 1 NULL 12 100.00 Using index; Using temporary +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 100.00 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 @@ -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 partitions type possible_keys key key_len ref rows 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 explain select fld3 from t2 where fld1=fld1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1199 +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 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 partitions type possible_keys key key_len ref rows 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 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 68d1f2971ac..c6c23996b43 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 20.00 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 100.00 +1 SIMPLE supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 +1 SIMPLE customer NULL ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 100.00 +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%) 11.93 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 20.00 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 100.00 +1 SIMPLE supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 +1 SIMPLE customer NULL ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 100.00 +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%) 11.93 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 20.00 Using where; Using temporary; Using filesort +1 SIMPLE part NULL ALL PRIMARY NULL NULL NULL 200 0.88 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 100.00 Using where +1 SIMPLE supplier NULL eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 100.00 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%) 27.20 Using where; Using rowid filter +1 SIMPLE n2 NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 +1 SIMPLE customer NULL eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 Using where +1 SIMPLE n1 NULL eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE supplier NULL ALL PRIMARY,i_s_nationkey NULL NULL NULL 10 100.00 Using where; Using temporary; Using filesort +1 SIMPLE nation NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 +1 SIMPLE partsupp NULL ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_suppkey 4 dbt3_s001.supplier.s_suppkey 70 100.00 +1 SIMPLE part NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.partsupp.ps_partkey 1 100.00 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 100.00 +1 SIMPLE orders NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE part NULL range PRIMARY,i_p_retailprice i_p_retailprice 9 NULL 1 100.00 Using index condition +1 SIMPLE orders NULL ref PRIMARY,i_o_orderdate i_o_orderdate 4 const 1 100.00 +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 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 FLUSH TABLES; SET use_stat_tables='preferably'; EXPLAIN SELECT * FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 0 0.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE PROFILING NULL ALL NULL NULL NULL NULL NULL NULL +1 SIMPLE global_priv NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # diff --git a/mysql-test/main/stat_tables_disabled.result b/mysql-test/main/stat_tables_disabled.result index 3a5db32bd60..5397cd6e965 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL # 48.40 Using where; Using temporary; Using filesort +1 SIMPLE customer NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey # 100.00 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 # 54.15 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 48.40 Using where; Using temporary; Using filesort +1 SIMPLE customer NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 19.33 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 54.15 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orders NULL ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 48.40 Using where; Using temporary; Using filesort +1 SIMPLE customer NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.orders.o_custkey 1 19.33 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 54.15 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_innodb.result b/mysql-test/main/stat_tables_innodb.result index 4edd8715444..a1fea942791 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 20.00 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 100.00 +1 SIMPLE supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 Using index +1 SIMPLE customer NULL ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 100.00 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%) 14.20 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 20.00 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 100.00 +1 SIMPLE supplier NULL ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 100.00 Using index +1 SIMPLE customer NULL ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 100.00 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%) 14.20 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 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE region NULL ALL PRIMARY NULL NULL NULL 5 20.00 Using where; Using temporary; Using filesort +1 SIMPLE part NULL ALL PRIMARY NULL NULL NULL 200 0.88 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 100.00 Using where +1 SIMPLE supplier NULL eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 100.00 Using where +1 SIMPLE n2 NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 +1 SIMPLE orders NULL eq_ref PRIMARY,i_o_orderdate,i_o_custkey PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 30.13 Using where +1 SIMPLE customer NULL eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 100.00 Using where +1 SIMPLE n1 NULL eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE supplier NULL index PRIMARY,i_s_nationkey i_s_nationkey 5 NULL 10 100.00 Using where; Using index; Using temporary; Using filesort +1 SIMPLE nation NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 100.00 +1 SIMPLE partsupp NULL ref PRIMARY,i_ps_partkey,i_ps_suppkey i_ps_suppkey 4 dbt3_s001.supplier.s_suppkey 70 100.00 +1 SIMPLE part NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.partsupp.ps_partkey 1 100.00 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 100.00 +1 SIMPLE orders NULL eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE part NULL range PRIMARY,i_p_retailprice i_p_retailprice 9 NULL 1 100.00 Using where; Using index +1 SIMPLE orders NULL ref PRIMARY,i_o_orderdate i_o_orderdate 4 const 1 100.00 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 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 FLUSH TABLES; SET use_stat_tables='preferably'; EXPLAIN SELECT * FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 0 0.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE PROFILING NULL ALL NULL NULL NULL NULL NULL NULL +1 SIMPLE global_priv NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result index 82a33fbaf6d..324ef2262dd 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229060 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229060 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229376 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229376 100.00 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 e76eb05d989..f7d94cc632f 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229060 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229060 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229376 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 229376 100.00 drop table t0; drop table t1; set analyze_sample_percentage=@save_analyze_sample_percentage; @@ -4650,16 +4650,16 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1_json NULL ALL NULL NULL NULL NULL 10 +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 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 ( diff --git a/mysql-test/main/status.result b/mysql-test/main/status.result index ec8b9f867b7..711d32ffa32 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 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 8bcf8e2752f..e93f8f33e52 100644 --- a/mysql-test/main/subselect.result +++ b/mysql-test/main/subselect.result @@ -1924,9 +1924,9 @@ 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 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 +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 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1(id int); create table t2(id int); @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 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 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=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 where +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 drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 SUBQUERY t1 NULL index_subquery a a 5 func 3 100.00 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 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 +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 NULL 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL a NULL NULL NULL 9 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +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 PRIMARY 13 NULL 11 100.00 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 54.55 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref a a 5 const 1 100.00 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t2 NULL ref I1 I1 4 test.t2.b 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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; @@ -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 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 +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 NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x outr x ALL x x x x x x x +x x t1 x eq_ref x x x x x x x +x x t2 x index x 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) @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 100.00 Using join buffer (flat, BNL join) +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED it2 NULL ALL NULL NULL NULL NULL 4 100.00 +2 MATERIALIZED it3 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 +2 MATERIALIZED t2 NULL index idx idx 5 NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 +1 PRIMARY it NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 Using index +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 3 100.00 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 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 +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 temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it1 NULL ref idx_cvk_cik idx_cvk_cik 9 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED it2 NULL ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 0.00 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 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 +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 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ref a a 5 const 1 100.00 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +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 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 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 +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 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 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 t1 NULL index_subquery a a 19 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 100.00 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 100.00 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 100.00 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 100.00 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 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) +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +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) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 b NULL NULL NULL 2 100.00 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 100.00 Using index +3 SUBQUERY NULL 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +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 Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -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 +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 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 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 +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 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/subselect2.result b/mysql-test/main/subselect2.result index eaf333147b3..d3202bcb27b 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL DDOCTYPEID_IDX,DFOLDERID_IDX NULL NULL NULL 9 100.00 Using where +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 34 test.t2.DOCID 1 100.00 +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 34 test.t2.DOCTYPEID 1 100.00 +1 PRIMARY t3 NULL eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t2.FOLDERID 1 100.00 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 100.00 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 100.00 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 100.00 Using where +1 PRIMARY t3 NULL ref|filter PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX FFOLDERID_IDX|CMFLDRPARNT_IDX 34|35 test.t3.PARENTID 1 (29%) 28.57 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 2 100.00 Using where; Using index +1 PRIMARY t3 NULL ref b b 5 test.t2.a 2 100.00 Using index +2 SUBQUERY t1 NULL const PRIMARY,a PRIMARY 4 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 2 100.00 Using where; Using index +1 PRIMARY t3 NULL ref b b 5 test.t2.a 2 100.00 Using index +2 SUBQUERY t1 NULL const PRIMARY,a PRIMARY 4 const 1 100.00 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 @@ -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 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 +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 range date date 6 NULL 3 100.00 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 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 +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 range date date 6 NULL 3 100.00 Using index condition; Using where; Using filesort SELECT * FROM ( SELECT node_uid, date, mirror_date, @result := 0 AS result FROM t1 diff --git a/mysql-test/main/subselect3.result b/mysql-test/main/subselect3.result index 9d355325af3..cee4addd528 100644 --- a/mysql-test/main/subselect3.result +++ b/mysql-test/main/subselect3.result @@ -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 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 +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 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 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 +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 ref_or_null idx idx 10 test.t2.oref,func 4 100.00 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 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 +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 ref idx idx 5 test.t2.oref 2 100.00 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 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 +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 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 @@ -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 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 +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 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 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 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 +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 ALL NULL NULL NULL NULL 6 100.00 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 @@ -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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index; Full scan on NULL key +2 DEPENDENT SUBQUERY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.id 1 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 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 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 +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 +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DEPENDENT SUBQUERY NULL 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Start temporary; Using temporary; Using filesort +1 PRIMARY t12 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t22 NULL ALL NULL NULL NULL NULL 26 100.00 Using where; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t21 NULL ALL NULL NULL NULL NULL 26 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY X NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY Y NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY Z NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Start temporary; End temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; FirstMatch +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +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 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; FirstMatch(<derived2>); Using join buffer (flat, BNL join) +2 DERIVED t0 NULL ALL NULL NULL NULL NULL 11 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 100.00 Using where +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY B NULL ALL NULL NULL NULL NULL 10 100.00 Using join buffer (flat, BNL join) +1 PRIMARY E NULL ALL NULL NULL NULL NULL 5 100.00 Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY D NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY C NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 a a 5 test.t2.a 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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) +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 t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 t3 NULL ALL NULL NULL NULL NULL 6 100.00 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 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) +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 t3 NULL ALL NULL NULL NULL NULL 6 100.00 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 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) +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ref a a 5 test.t2.a 10 100.00 End temporary explain select straight_join * from t1 A, t1 B where A.a in (select a from t2); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY B NULL ALL NULL NULL NULL NULL 10 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B); -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY X NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY Y NULL ALL NULL NULL NULL NULL 10 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Start temporary +1 PRIMARY t3 NULL ref a a 5 test.t2.a 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Start temporary +1 PRIMARY t3 NULL ref a a 5 test.t4.x 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref a a 10 const,test.t2.a 1 100.00 Using index; FirstMatch(t2) explain select * from t2 where (b,a) in (select a,b from t1 where a=3); -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref a a 10 const,test.t2.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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) +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 X NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY Y NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY Z NULL ALL NULL NULL NULL NULL 6 100.00 Using where; End temporary; Using join buffer (flat, BNL join) drop table t0,t1,t2; set @@optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/subselect3_jcl6.result b/mysql-test/main/subselect3_jcl6.result index e5c19da69f4..77b6468dd62 100644 --- a/mysql-test/main/subselect3_jcl6.result +++ b/mysql-test/main/subselect3_jcl6.result @@ -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 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 +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 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 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 +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 ref_or_null idx idx 10 test.t2.oref,func 4 100.00 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 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 +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 ref idx idx 5 test.t2.oref 2 100.00 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 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 +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 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 @@ -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 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 +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 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 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 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 +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 ALL NULL NULL NULL NULL 6 100.00 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 @@ -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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index; Full scan on NULL key +2 DEPENDENT SUBQUERY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t2.id 1 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL unique_subquery PRIMARY PRIMARY 4 func 1 100.00 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 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 +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 +3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +2 DEPENDENT SUBQUERY NULL 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t11 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Start temporary; Using temporary; Using filesort +1 PRIMARY t12 NULL hash_ALL NULL #hash#$hj 4 test.t11.a 8 100.00 Using where; Using join buffer (flat, BNLH join) +1 PRIMARY t22 NULL hash_ALL NULL #hash#$hj 4 test.t11.a 26 100.00 Using where; End temporary; Using join buffer (incremental, BNLH join) +1 PRIMARY t21 NULL hash_ALL NULL #hash#$hj 4 test.t11.a 26 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY X NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY Y NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY Z NULL hash_ALL NULL #hash#$hj 5 test.Y.a 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; Start temporary; End temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 11 100.00 Using where; FirstMatch +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +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 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where; FirstMatch(<derived2>); Using join buffer (flat, BNL join) +2 DERIVED t0 NULL ALL NULL NULL NULL NULL 11 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 100.00 Using where +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY B NULL ALL NULL NULL NULL NULL 10 100.00 Using join buffer (flat, BNL join) +1 PRIMARY E NULL ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; Using join buffer (incremental, BNL join) +1 PRIMARY D NULL hash_ALL NULL #hash#$hj 5 test.E.a 10 100.00 Using where; Using join buffer (incremental, BNLH join) +1 PRIMARY C NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 a a 5 test.t2.a 1 100.00 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 t1 NULL hash_ALL NULL #hash#$hj 4 test.t2.a 4 100.00 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 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) +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 t2 NULL hash_ALL NULL #hash#$hj 5 test.t2.a 2 100.00 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 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) +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 t3 NULL ALL NULL NULL NULL NULL 6 100.00 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 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) +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 t3 NULL ALL NULL NULL NULL NULL 6 100.00 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 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) +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 t1 NULL hash_ALL NULL #hash#$hj 6 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ref a a 5 test.t2.a 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY B NULL ALL NULL NULL NULL NULL 10 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where explain select * from t2 where a in (select straight_join A.a from t1 A, t1 B); -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY X NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY Y NULL ALL NULL NULL NULL NULL 10 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY A NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 DEPENDENT SUBQUERY B NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Start temporary +1 PRIMARY t3 NULL ref a a 5 test.t2.a 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Start temporary +1 PRIMARY t3 NULL ref a a 5 test.t4.x 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref a a 10 const,test.t2.a 1 100.00 Using index; FirstMatch(t2) explain select * from t2 where (b,a) in (select a,b from t1 where a=3); -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref a a 10 const,test.t2.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY t2 NULL hash_ALL NULL #hash#$hj 10 test.t1.a,test.t1.b 100 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +1 PRIMARY t2 NULL hash_ALL NULL #hash#$hj 10 test.t1.a,test.t1.b 100 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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) +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 X NULL hash_ALL NULL #hash#$hj 5 test.t1.a 6 100.00 Using where; Start temporary; Using join buffer (flat, BNLH join) +1 PRIMARY Y NULL hash_ALL NULL #hash#$hj 5 test.t1.b 6 100.00 Using where; Using join buffer (incremental, BNLH join) +1 PRIMARY Z NULL hash_ALL NULL #hash#$hj 5 test.t1.c 6 100.00 Using where; End temporary; Using join buffer (incremental, BNLH join) drop table t0,t1,t2; set @@optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index 27b50503c95..e90950eeab4 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 5 NULL 2 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 0 0.00 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 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) +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 DEPENDENT SUBQUERY t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ALL b NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows 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 DESCRIBE SELECT 1 LIKE ( 1 IN ( SELECT 1 ) ); -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 +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 # 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x PRIMARY x x x x x x x x x Using where +x DEPENDENT SUBQUERY x x x x x x x x x Using where 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x PRIMARY x x x x x x x x x Using where +x DEPENDENT SUBQUERY x x x x x x x x x Using where 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x PRIMARY x x x x x x x x x Using where +x DEPENDENT SUBQUERY x x x x x x x x x Using where 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x PRIMARY x x x x x x x x x Using where +x DEPENDENT SUBQUERY x x x x x x x x x Using where 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x PRIMARY x x x x x x x x x Using where +x DEPENDENT SUBQUERY x x x x x x x x x Using where 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2a NULL unique_subquery PRIMARY PRIMARY 8 const,test.t1.pk 1 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2b NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2c NULL index_subquery it2c it2c 8 const,test.t1.pk 2 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2d NULL const PRIMARY PRIMARY 4 const 1 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2a NULL unique_subquery PRIMARY PRIMARY 8 const,test.t1.pk 1 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2b NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2c NULL index_subquery it2c it2c 8 const,test.t1.pk 2 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2d NULL const PRIMARY PRIMARY 4 const 1 100.00 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 @@ -493,11 +493,11 @@ WHERE PNUM IN (SELECT PNUM FROM t2 WHERE PTYPE = 'Design')); -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) EXECUTE stmt; -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) EXECUTE stmt; -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL t1_IDX NULL NULL NULL 5 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 100.00 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 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) +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 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 100.00 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 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) +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 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 100.00 Using where; Using join buffer (flat, BNL join) EXECUTE stmt; -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) +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 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 12 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL ALL NULL NULL NULL NULL 10 100.00 +2 DEPENDENT SUBQUERY X NULL ALL NULL NULL NULL NULL 10 100.00 +2 DEPENDENT SUBQUERY B NULL ALL a,b NULL NULL NULL 1000 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref f3 f3 5 const 0 0.00 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref f3 f3 5 const 0 0.00 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 t2 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 PRIMARY t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 DEPENDENT SUBQUERY t1 NULL index_subquery f2 f2 4 func 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 PRIMARY t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 MATERIALIZED t1 NULL index NULL f2 4 NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 +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 join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 t4 NULL index NULL PRIMARY 3 NULL 2 100.00 Using index; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 NULL NULL NULL NULL 11 100.00 Using where +2 DEPENDENT SUBQUERY SUBQUERY2_t1 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY SUBQUERY2_t2 NULL index NULL f4 5 NULL 11 100.00 Using index +2 DEPENDENT SUBQUERY SUBQUERY2_t3 NULL ALL NULL NULL NULL NULL 11 100.00 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 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) +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 SUBQUERY SQ1_t3 NULL range f4 f4 5 NULL 2 100.00 Using where; Using index; Using temporary +3 SUBQUERY SQ1_t1 NULL index NULL f4 5 NULL 2 100.00 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 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 +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 index_subquery k k 5 const 2 100.00 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 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 +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 SUBQUERY NULL 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 100.00 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 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 +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 SUBQUERY NULL 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 100.00 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 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 +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 SUBQUERY NULL 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 100.00 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 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 +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 SUBQUERY NULL 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 100.00 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 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 +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 SUBQUERY NULL 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 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 +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 SUBQUERY NULL 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 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 +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 <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 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 SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 ); bug EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v1 ); -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 +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 <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 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 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 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 +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 <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 100.00 +4 UNION t2 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL 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 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 +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 +2 MATERIALIZED <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 100.00 +4 UNION t2 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL 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 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 +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 <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 100.00 +4 UNION t2 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL 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 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 +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 <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 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 SELECT 'bug' FROM DUAL WHERE ( 5 ) IN ( SELECT * FROM v1 ); bug EXPLAIN SELECT ( 5 ) IN ( SELECT * FROM v1 ); -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 +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 <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 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 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 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 +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 <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 100.00 +4 UNION t2 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL 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 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 +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 +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 100.00 +4 UNION t2 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL 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 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 +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 <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED t1 NULL system NULL NULL NULL NULL 1 100.00 +4 UNION t2 NULL system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY alias1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t0 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY alias1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using where; Using index +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 NULL 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 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) +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 ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 t3 NULL system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t2 NULL ref_or_null f10 f10 10 const,const 2 100.00 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 2 100.00 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref f1 f1 5 const 0 0.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 +3 SUBQUERY t4 NULL index NULL f1 5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref f1 f1 5 const 0 0.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 +3 SUBQUERY t4 NULL index NULL f1 5 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL col_int_key 5 NULL 2 100.00 Using index +2 SUBQUERY SUBQUERY2_t1 NULL index NULL col_int_key 5 NULL 2 100.00 Using index +2 SUBQUERY SUBQUERY2_t2 NULL ALL col_varchar_key NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index NULL col_int_key 5 NULL 2 100.00 Using index +2 SUBQUERY SUBQUERY2_t1 NULL index NULL col_int_key 5 NULL 2 100.00 Using index +2 SUBQUERY SUBQUERY2_t2 NULL ALL col_varchar_key NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 2 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 2 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 2 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using filesort +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 MATERIALIZED NULL 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 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 +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 t3 NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 t3 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 t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using where +2 SUBQUERY five NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 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 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 +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 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 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 +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 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 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 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) +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 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using filesort +2 SUBQUERY NULL 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 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 +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 SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1); 2 IN (SELECT 2 from DUAL WHERE 1 != 1) 0 @@ -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 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 +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 A NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION B NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 A NULL ALL NULL NULL NULL NULL 2 100.00 +3 UNION B NULL ALL NULL NULL NULL NULL 2 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 A NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION B NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 6000 100.00 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 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 +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 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table +2 SUBQUERY NULL 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 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 +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 SUBQUERY NULL 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 Using where +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 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 16 func,func 1 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 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 100 100.00 # 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 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 100 100.00 # 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +2 DEPENDENT SUBQUERY NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 100 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 100 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 100 100.00 drop table t0, t1, t2; # End of 10.4 tests diff --git a/mysql-test/main/subselect_cache.result b/mysql-test/main/subselect_cache.result index c5864dee4ee..5731e227bdb 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 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 +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 ALL NULL NULL NULL NULL 10 100.00 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 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 +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 ALL NULL NULL NULL NULL 10 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 10 100.00 flush status; select * from t1 where a in (select pk from t2); a b diff --git a/mysql-test/main/subselect_exists2in.result b/mysql-test/main/subselect_exists2in.result index d45cf944106..8c4fcfaee86 100644 --- a/mysql-test/main/subselect_exists2in.result +++ b/mysql-test/main/subselect_exists2in.result @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 76.83 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 76.83 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 100.00 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 @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1000 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1000 100.00 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 49eedc9c6d5..d6e61fe4609 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL ALL Name,SurfaceArea NULL NULL NULL 239 29.71 Using where +2 MATERIALIZED City NULL ALL Population,Country NULL NULL NULL 4079 87.45 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 c0c7ceab771..0abecfb4bda 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY INNR NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY INNR NULL ALL NULL NULL NULL NULL 2 100.00 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 @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 76.83 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 76.83 Using where; Using index +2 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY,i2 PRIMARY 4 NULL 144 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 5 NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 5 NULL 2 100.00 EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2; -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 +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 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 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 +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 index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 100.00 DROP TABLE t1, t2; # # From derived_view.test @@ -391,10 +391,10 @@ a 2 EXPLAIN SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1); -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 +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 <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 2 100.00 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 <derived3> NULL ref key0 key0 10 test.t1.a,test.t1.b 1 100.00 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 100.00 +4 UNION t3 NULL ALL NULL NULL NULL NULL 4 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL 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 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 +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 t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 3 100.00 Using where; FirstMatch(t3); Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 <derived3> NULL ref key1 key1 8 const,const 0 0.00 Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; End temporary; Using join buffer (flat, BNL join) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 <derived3> NULL ref key0 key0 10 test.t1.b,test.t1.a 2 100.00 FirstMatch(t1) +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 332367afaba..db25f666b7f 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY INNR NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY OUTR NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY INNR NULL ALL NULL NULL NULL NULL 2 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 76.83 Using where; Using index +3 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL idx_t1_1 163 NULL 128 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL idx_t2_1 163 NULL 164 76.83 Using where; Using index +3 DEPENDENT SUBQUERY t3 NULL index NULL idx_t3_1 10 NULL 192 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL 144 100.00 Using where; Using index +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL a 5 NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL a 5 NULL 2 100.00 EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2; -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 +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 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 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 +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 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 144 100.00 DROP TABLE t1, t2; # # From derived_view.test @@ -393,10 +393,10 @@ a 2 EXPLAIN SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v1); -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 +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 <derived3> NULL index_subquery key0 key0 10 func,func 2 100.00 Using where +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 <derived3> NULL index_subquery key0 key0 10 func,func 1 100.00 Using where +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 6 100.00 +4 UNION t3 NULL ALL NULL NULL NULL NULL 4 100.00 +NULL UNION RESULT <union3,4> NULL ALL NULL 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 3 100.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY <derived3> NULL ref key1 key1 8 const,const 0 0.00 Using where +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 <derived3> NULL ref key0 key0 5 test.t1.a 2 100.00 Using where +3 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 a77fdf5dd9f..59a827e0f79 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +2 DEPENDENT SUBQUERY t2 NULL unique_subquery PRIMARY,d PRIMARY 1 func 1 100.00 Using where +3 DEPENDENT SUBQUERY t2 NULL index NULL d 2 NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL ref t1_id,t1_id_position t1_id_position 5 test.t1.id 1 100.00 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 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 +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 NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using temporary SELECT * FROM t1 WHERE t1.a = ( @@ -399,10 +399,10 @@ FROM t3 GROUP BY 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 +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 NULL NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 1 100.00 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +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 index NULL PRIMARY 4 NULL 1 100.00 Using index; Using temporary +2 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +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 SQ2_alias2 NULL index NULL col_int_key 5 NULL 1 100.00 Using index; Using temporary +2 SUBQUERY SQ2_alias1 NULL ref col_int_key col_int_key 5 test.SQ2_alias2.col_int_key 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 +2 DEPENDENT SUBQUERY t2 NULL ref key1 key1 5 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # 100.00 +2 DEPENDENT SUBQUERY t2 NULL ref key1 key1 5 test.t1.a # 100.00 Using where; Using filesort drop table t1,t2; # # mdev-12931: semi-join in ON expression of STRAIGHT_JOIN diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result index c071d82dc97..026f417f3e3 100644 --- a/mysql-test/main/subselect_mat.result +++ b/mysql-test/main/subselect_mat.result @@ -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 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 +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 execute st1; -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 +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 prepare st2 from "select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1)"; execute st2; a1 a2 @@ -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 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 +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 NULL 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 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 +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 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 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 +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 NULL 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 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 +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 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 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 +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 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 matching row in const table +3 MATERIALIZED NULL 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 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 +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 MATERIALIZED t1 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 7 func,func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 3 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 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 @@ -1887,10 +1887,10 @@ SELECT alias3.c FROM t2 AS alias3, t2 AS alias4 WHERE alias4.c = alias3.b ); -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 +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 MATERIALIZED alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 MATERIALIZED alias4 NULL ref c c 11 test.alias3.b 2 100.00 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 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 +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 Using where +2 MATERIALIZED t2 NULL ALL i_a NULL NULL NULL 8 100.00 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 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 +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 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'; @@ -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 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 +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 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 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 +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 index NULL c 5 NULL 8 100.00 Using where; Using index +2 MATERIALIZED s2 NULL ref d d 4 const 2 100.00 Using where; Using index +2 MATERIALIZED s1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 index NULL c 5 NULL 8 100.00 Using where; Using index +2 MATERIALIZED s2 NULL ref d d 4 const 2 100.00 Using where; Using index +2 MATERIALIZED s1 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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)); @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY sq1 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 sq2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 # this checks the result set above set optimizer_switch= 'materialization=off,semijoin=off'; SELECT sq1.f2 FROM t1 AS sq1 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ref idx3,idx4 idx4 35 const 2 100.00 Using index condition; Using where; Start temporary +1 PRIMARY t3_i NULL eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 100.00 Using index condition; Using where +1 PRIMARY t1 NULL ref idx1,idx2 idx1 35 test.t3_i.sys_id 2 100.00 Using index condition; Using where; End temporary +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 100.00 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 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 +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 t1 NULL ref idx1,idx2 idx1 35 test.t2.ugroup 2 100.00 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ref idx3,idx4 idx4 35 const 2 100.00 Using index condition; Using where +2 MATERIALIZED t3_i NULL eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 100.00 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 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 +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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index id id 4 NULL 9 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 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index id id 4 NULL 9 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 3 100.00 Using where SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1); 1 1 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1000 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 3 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 MATERIALIZED t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 MATERIALIZED t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 1 100.00 Using where +2 MATERIALIZED t3 NULL system NULL NULL NULL NULL 0 0.00 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 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 +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 1 100.00 Using where +2 MATERIALIZED t3 NULL system NULL NULL NULL NULL 0 0.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 2 100.00 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 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 +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 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY NULL 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY NULL 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 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 +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 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY NULL 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 SUBQUERY NULL 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 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 +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 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using filesort SELECT (f1, f2, f3) NOT IN (SELECT COUNT(DISTINCT f2), f1, f3 FROM t1 GROUP BY f1, f3) FROM 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 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 +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 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 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 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 +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 +3 MATERIALIZED NULL 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 fb6d9698326..adc60ede47d 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL ALL Name,SurfaceArea NULL NULL NULL 239 29.71 Using where +2 MATERIALIZED City NULL ALL Population,Country NULL NULL NULL 4079 87.45 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL range Name,SurfaceArea SurfaceArea 4 NULL 5 100.00 Using index condition; Using where; Rowid-ordered scan +2 DEPENDENT SUBQUERY City NULL index_subquery Population,Country Country 3 func 17 87.45 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL ALL PRIMARY,SurfaceArea NULL NULL NULL 239 19.67 Using where +1 PRIMARY City NULL ref Country Country 3 world.Country.Code 17 100.00 Using where +2 MATERIALIZED CountryLanguage NULL ALL Percentage,Language NULL NULL NULL 984 20.02 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL ALL PRIMARY,SurfaceArea NULL NULL NULL 239 19.67 Using where +1 PRIMARY City NULL ref Country Country 3 world.Country.Code 17 100.00 +2 DEPENDENT SUBQUERY CountryLanguage NULL index_subquery Percentage,Language Language 30 func 2 20.02 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL ALL PRIMARY,SurfaceArea NULL NULL NULL 239 30.54 Using where +1 PRIMARY City NULL ref Country Country 3 world.Country.Code 17 100.00 Using where +3 MATERIALIZED CountryLanguage NULL index PRIMARY,Language PRIMARY 33 NULL 984 100.00 Using index +2 DEPENDENT SUBQUERY CountryLanguage NULL unique_subquery PRIMARY,Percentage,Language PRIMARY 33 func,func 1 20.02 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY City NULL index NULL PRIMARY 4 NULL 4079 100.00 Using where; Using index +2 MATERIALIZED Country NULL ALL NULL NULL NULL NULL 239 19.09 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY CountryLanguage NULL ref PRIMARY,Language Language 30 const 19 100.00 Using index condition +1 PRIMARY Country NULL eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 100.00 Using where +2 DEPENDENT SUBQUERY CountryLanguage NULL unique_subquery PRIMARY,Language PRIMARY 33 func,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY CountryLanguage NULL range PRIMARY,Language Language 30 NULL 44 100.00 Using index condition; Rowid-ordered scan +1 PRIMARY Country NULL eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 100.00 Using where +3 DEPENDENT SUBQUERY CountryLanguage NULL unique_subquery PRIMARY,Language PRIMARY 33 func,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY CountryLanguage NULL range Language Language 30 NULL 73 100.00 Using index condition; Using where; Rowid-ordered scan +2 DEPENDENT SUBQUERY City NULL ref CityName CityName 35 func 1 100.00 Using index condition +2 DEPENDENT SUBQUERY Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY CountryLanguage NULL index NULL PRIMARY 33 NULL 984 100.00 Using where; Using index +2 MATERIALIZED City NULL ALL NULL NULL NULL NULL 4079 100.00 +2 MATERIALIZED Country NULL eq_ref PRIMARY PRIMARY 3 world.City.Country 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY CountryLanguage NULL index NULL PRIMARY 33 NULL 984 100.00 Using where; Using index +3 MATERIALIZED Country NULL index PRIMARY PRIMARY 3 NULL 239 100.00 Using index +3 MATERIALIZED CountryLanguage NULL ref PRIMARY PRIMARY 3 world.Country.Code 4 100.00 Using index +2 MATERIALIZED Country NULL index PRIMARY PRIMARY 3 NULL 239 100.00 Using index +2 MATERIALIZED CountryLanguage NULL ref PRIMARY PRIMARY 3 world.Country.Code 4 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL ALL NULL NULL NULL NULL 239 100.00 Using where +1 PRIMARY City NULL eq_ref PRIMARY PRIMARY 4 world.Country.Capital 1 100.00 Using where +2 MATERIALIZED City NULL index NULL CityName 35 NULL 4079 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL ALL NULL NULL NULL NULL 239 100.00 Using where +2 MATERIALIZED City NULL ALL NULL NULL NULL NULL 4079 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY City NULL range Population Population 5 NULL 3 100.00 Using index condition; Rowid-ordered scan +2 MATERIALIZED Country NULL ALL NULL NULL NULL NULL 239 97.07 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY City NULL range Population Population 5 NULL 3 100.00 Using index condition; Rowid-ordered scan +2 SUBQUERY Country NULL index_subquery CountryCapital CountryCapital 5 func 2 97.49 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY Country NULL index PRIMARY PRIMARY 3 NULL 239 100.00 Using index; Using temporary; Using filesort +1 PRIMARY City NULL ref Country Country 3 world.Country.Code 17 100.00 +2 MATERIALIZED Country NULL ALL Name NULL NULL NULL 239 35.56 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY City NULL ALL NULL NULL NULL NULL 4079 100.00 Using where +2 DEPENDENT SUBQUERY City NULL ref Population,Country,CityName CityName 35 func 1 0.25 Using where +3 DEPENDENT UNION City NULL ref Population,Country,CityName CityName 35 func 1 1.02 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 41e5dff9b49..97176c3b744 100644 --- a/mysql-test/main/subselect_mat_cost_bugs.result +++ b/mysql-test/main/subselect_mat_cost_bugs.result @@ -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 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 +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 NULL 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 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 +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 1 100.00 +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 +3 SUBQUERY t1 NULL index NULL f3 5 NULL 2 100.00 Using index +2 DERIVED NULL 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 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 +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 +3 SUBQUERY t1 NULL index NULL f3 5 NULL 2 100.00 Using index +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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; Using filesort +1 PRIMARY alias1 NULL eq_ref PRIMARY PRIMARY 4 alias2.f3 1 100.00 Using index +3 DEPENDENT SUBQUERY t1 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index +3 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 MATERIALIZED alias1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED alias2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 MATERIALIZED alias1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED alias2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ref key1,key2,key3 key3 5 const 1 25.00 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 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 +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 t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t5 NULL index c c 10 NULL 2 100.00 Using where; Using index; Start temporary +2 DEPENDENT SUBQUERY t4 NULL eq_ref PRIMARY PRIMARY 4 test.t5.b 1 100.00 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 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 +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 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 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 +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 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 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 +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 t2 NULL const PRIMARY,a2 PRIMARY 4 const 1 100.00 +2 SUBQUERY t1 NULL ref a1,b1 b1 6 const 1 100.00 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 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 +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 DEPENDENT SUBQUERY t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL index i2 i2 11 NULL 2 100.00 Using where; Using index DROP TABLE t1,t2,t3; # # MDEV-7599: in-to-exists chosen after min/max optimization @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index idx idx 5 NULL 5 100.00 Using where; Using index +2 DEPENDENT SUBQUERY NULL 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 fd01ca18b0e..574aec5b996 100644 --- a/mysql-test/main/subselect_no_exists_to_in.result +++ b/mysql-test/main/subselect_no_exists_to_in.result @@ -1928,9 +1928,9 @@ 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 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 +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 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1(id int); create table t2(id int); @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 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 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=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 where +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 drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 SUBQUERY t1 NULL index_subquery a a 5 func 3 100.00 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 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 +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 NULL 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL a NULL NULL NULL 9 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +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 PRIMARY 13 NULL 11 100.00 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 54.55 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref a a 5 const 1 100.00 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t2 NULL ref I1 I1 4 test.t2.b 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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; @@ -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 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 +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 NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x outr x ALL x x x x x x x +x x t1 x eq_ref x x x x x x x +x x t2 x index x 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) @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 100.00 Using join buffer (flat, BNL join) +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED it2 NULL ALL NULL NULL NULL NULL 4 100.00 +2 MATERIALIZED it3 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL ref idx idx 5 test.t1.a 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 +1 PRIMARY it NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 Using index +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 3 100.00 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 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 +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 temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it1 NULL ref idx_cvk_cik idx_cvk_cik 9 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED it2 NULL ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 0.00 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 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 +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 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ref a a 5 const 1 100.00 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +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 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 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 +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 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 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 t1 NULL index_subquery a a 19 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 100.00 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 100.00 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 100.00 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 100.00 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 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) +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +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) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 b NULL NULL NULL 2 100.00 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 100.00 Using index +3 SUBQUERY NULL 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +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 Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -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 +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 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 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 +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 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 9e218496722..1477a6c488d 100644 --- a/mysql-test/main/subselect_no_mat.result +++ b/mysql-test/main/subselect_no_mat.result @@ -1931,9 +1931,9 @@ 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 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 +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 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1(id int); create table t2(id int); @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 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 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=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 where +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 drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 SUBQUERY t1 NULL index_subquery a a 5 func 3 100.00 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 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 +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 NULL 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +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 t1 NULL index NULL a 8 NULL 1 100.00 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 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 +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 PRIMARY 13 NULL 11 100.00 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 54.55 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref a a 5 const 1 100.00 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t2 NULL ref I1 I1 4 test.t2.b 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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; @@ -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 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 +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 NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x outr x ALL x x x x x x x +x x t1 x eq_ref x x x x x x x +x x t2 x index x 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) @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY it2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY it3 NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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) +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 Using where +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 +1 PRIMARY it NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 Using index +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 3 100.00 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 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 +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 temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY it1 NULL ref idx_cvk_cik idx_cvk_cik 9 const,const 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY it2 NULL ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 0.00 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 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 +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 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ref a a 5 const 1 100.00 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +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 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 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 +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 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 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 t1 NULL index_subquery a a 19 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 100.00 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 100.00 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 100.00 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 100.00 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 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) +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +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) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 b NULL NULL NULL 2 100.00 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 100.00 Using index +3 SUBQUERY NULL 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +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 Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -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 +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 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 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 +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 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 59118365a1d..30d8c8d1311 100644 --- a/mysql-test/main/subselect_no_opts.result +++ b/mysql-test/main/subselect_no_opts.result @@ -1927,9 +1927,9 @@ 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 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 +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 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1(id int); create table t2(id int); @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 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 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=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 where +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 drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 SUBQUERY t1 NULL index_subquery a a 5 func 3 100.00 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 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 +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 NULL 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +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 t1 NULL index NULL a 8 NULL 1 100.00 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 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 +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 PRIMARY 13 NULL 11 100.00 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 54.55 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref a a 5 const 1 100.00 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -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 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 +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 t1 NULL index_subquery I1 I1 2 func 2 100.00 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 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 +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 t2 NULL index_subquery I1 I1 4 func 2 100.00 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 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 +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 t1 NULL index_subquery I1 I1 2 func 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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; @@ -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 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 +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 NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x outr x ALL x x x x x x x +x x t1 x eq_ref x x x x x x x +x x t2 x index x 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) @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY it2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 DEPENDENT SUBQUERY it3 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 Using where +2 DEPENDENT SUBQUERY t2 NULL index_subquery idx idx 5 func 2 100.00 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 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 +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 it NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL index NULL PRIMARY 4 NULL 3 100.00 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 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 +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 temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY it1 NULL index_subquery idx_cvk_cik idx_cvk_cik 9 func,const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY it2 NULL index_subquery idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 func,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 0.00 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 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 +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 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ref a a 5 const 1 100.00 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +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 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 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 +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 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 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 t1 NULL index_subquery a a 19 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 100.00 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 100.00 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 100.00 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 100.00 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 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) +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +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) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 b NULL NULL NULL 2 100.00 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 100.00 Using index +3 SUBQUERY NULL 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +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 Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -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 +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 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 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 +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 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 8fe088858e7..532fb2e07e2 100644 --- a/mysql-test/main/subselect_no_scache.result +++ b/mysql-test/main/subselect_no_scache.result @@ -1930,9 +1930,9 @@ 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 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 +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 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1(id int); create table t2(id int); @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 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 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=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 where +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 drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 SUBQUERY t1 NULL index_subquery a a 5 func 3 100.00 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 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 +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 NULL 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL a NULL NULL NULL 9 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 21 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +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 PRIMARY 13 NULL 11 100.00 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 54.55 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref a a 5 const 1 100.00 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t2 NULL ref I1 I1 4 test.t2.b 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL I2 NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref I1 I1 2 test.t1.b 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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; @@ -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 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 +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 NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x outr x ALL x x x x x x x +x x t1 x eq_ref x x x x x x x +x x t2 x index x 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) @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 100.00 Using join buffer (flat, BNL join) +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED it2 NULL ALL NULL NULL NULL NULL 4 100.00 +2 MATERIALIZED it3 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 +2 MATERIALIZED t2 NULL index idx idx 5 NULL 3 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 3 100.00 +1 PRIMARY it NULL eq_ref PRIMARY PRIMARY 4 test.t1.pk 1 100.00 Using index +1 PRIMARY t2 NULL index NULL PRIMARY 4 NULL 3 100.00 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 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 +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 temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it1 NULL ref idx_cvk_cik idx_cvk_cik 9 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED it2 NULL ref idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 const,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 0.00 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 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 +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 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ref a a 5 const 1 100.00 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +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 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 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 +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 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 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 t1 NULL index_subquery a a 19 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 100.00 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 100.00 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 100.00 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 100.00 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 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) +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +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) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 b NULL NULL NULL 2 100.00 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 100.00 Using index +3 SUBQUERY NULL 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +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 Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -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 +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 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 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 +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 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 aa19495d265..351f3aa7625 100644 --- a/mysql-test/main/subselect_no_semijoin.result +++ b/mysql-test/main/subselect_no_semijoin.result @@ -1927,9 +1927,9 @@ 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 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 +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 UNCACHEABLE SUBQUERY t1 NULL system NULL NULL NULL NULL 1 100.00 drop table t1; create table t1(id int); create table t2(id int); @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 8 NULL 3 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 8 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 do @a:= (select sum(a) from t1 where b > @b); explain select a from t1 where c=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 where +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 drop table t1; connect root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK; connection root; @@ -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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 r NULL const PRIMARY PRIMARY 4 const 1 100.00 +2 SUBQUERY t2 NULL range b b 40 NULL 3 50.00 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 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 +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 MATERIALIZED t1 NULL index a a 5 NULL 5 100.00 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 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 +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 NULL 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 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 +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 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +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 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 9 100.00 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 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 +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 PRIMARY 13 NULL 11 100.00 Using where; Using index +2 SUBQUERY t1 NULL range PRIMARY PRIMARY 13 NULL 6 54.55 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +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 no matching row in const table +3 UNION NULL 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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref a a 5 const 1 100.00 Using where; Using index +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort DROP TABLE t1; CREATE TABLE t1 (id int NOT NULL, st CHAR(2), INDEX idx(id)); INSERT INTO t1 VALUES @@ -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 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 +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 t1 NULL index_subquery I1 I1 2 func 2 100.00 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 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 +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 t2 NULL index_subquery I1 I1 4 func 2 100.00 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 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 +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 t1 NULL index_subquery I1 I1 2 func 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_outer NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using temporary; Using filesort +2 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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; @@ -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 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 +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 NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x outr x ALL x x x x x x x +x x t1 x index x x x x x x x +x x t2 x index x 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) @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t3 NULL ref b,b_2 b 5 test.t1.a 1 100.00 Using index +2 DEPENDENT SUBQUERY t2 NULL ref b,b_2,c b 10 test.t3.c,test.t1.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY ot4 NULL ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED it2 NULL ALL NULL NULL NULL NULL 4 100.00 +2 MATERIALIZED it3 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 Using where +2 MATERIALIZED t2 NULL index idx idx 5 NULL 3 100.00 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 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 +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 index NULL PRIMARY 4 NULL 3 100.00 Using index +2 MATERIALIZED it NULL index PRIMARY PRIMARY 4 NULL 3 100.00 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 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 +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 temporary; Using filesort +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY it1 NULL index_subquery idx_cvk_cik idx_cvk_cik 9 func,const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY it2 NULL index_subquery idx_cvk_cvk2_cik,idx_cvk_cik idx_cvk_cvk2_cik 8 func,const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE sq4_alias1 NULL system NULL NULL NULL NULL 0 0.00 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 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 +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 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY c_sq1_alias1 NULL system PRIMARY NULL NULL NULL 1 100.00 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ref a a 5 const 1 100.00 set optimizer_switch=@tmp_optimizer_switch; EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7); -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 +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 SUBQUERY t1 NULL ref a a 5 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY table1 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY table2 NULL index NULL f1_key 4 NULL 10 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t2 NULL index f1_key f1_key 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 4 func 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL a 4 NULL 2 100.00 Using where; Using index +2 MATERIALIZED t1 NULL index NULL a 4 NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL system NULL NULL NULL NULL 0 0.00 Const row not found +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +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 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 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 +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 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 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 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 +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 DEPENDENT SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 t1 NULL index_subquery a a 19 const 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL index a a 19 NULL 11 100.00 Using where; Using index +1 PRIMARY alias2 NULL ref a a 19 test.alias1.a 2 100.00 Using index +1 PRIMARY alias3 NULL index NULL a 19 NULL 11 100.00 Using index; Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL index_subquery a a 19 const 1 100.00 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 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) +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 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +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) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 join buffer (flat, BNL join) +1 PRIMARY alias3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 b NULL NULL NULL 2 100.00 Using where +1 PRIMARY t3 NULL ref d d 5 test.t2.b 2 100.00 Using index +3 SUBQUERY NULL 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY <subquery3> NULL ALL distinct_key NULL NULL NULL 1 100.00 +2 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 range a a 5 NULL 2 100.00 Using where; Using index +2 SUBQUERY t2 NULL ref b b 5 test.t1.a 2 100.00 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 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 +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 Select tables optimized away explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3; -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 +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 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 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 +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 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 22ac530d8da..449a158c584 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 DEPENDENT SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 NULL NULL NULL NULL 35 100.00 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 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 +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 35 100.00 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 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 +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 NULL NULL NULL NULL 35 100.00 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 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 +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 35 100.00 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 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 +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 NULL NULL NULL NULL 35 100.00 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 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 +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 35 100.00 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 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 +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 NULL NULL NULL NULL 35 100.00 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 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 +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 35 100.00 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 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 +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 NULL NULL NULL NULL 35 100.00 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 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 +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 35 100.00 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 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 +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 NULL NULL NULL NULL 35 100.00 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 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 +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 35 100.00 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 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 +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 NULL NULL NULL NULL 4 100.00 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 @@ -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 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 +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 t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t3 NULL system NULL NULL NULL NULL 1 100.00 +2 MATERIALIZED t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 DEPENDENT SUBQUERY t3 NULL system NULL NULL NULL NULL 1 100.00 +2 DEPENDENT SUBQUERY t2 NULL system NULL NULL NULL NULL 1 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 ALL NULL NULL NULL NULL 2 100.00 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 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 +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 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 3 100.00 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 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 +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 3 100.00 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 c231cfd0c0b..f0d474b55f0 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t10 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 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 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 +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 index +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 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 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 +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 select * from t1 where a in (select pk from t10 where t10.a in (select pk from t12)); a b 0 0 @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY s00 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY s01 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s02 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s03 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s04 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s05 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s06 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s07 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s08 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s09 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s10 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s11 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s12 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s13 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s14 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s15 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s16 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s17 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s18 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s19 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s20 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s21 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s22 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s23 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s24 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s25 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s26 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s27 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s28 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s29 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s30 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s31 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s32 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s33 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s34 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s35 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s36 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s37 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s38 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s39 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s40 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s41 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s42 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s43 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s44 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s45 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s46 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s47 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s48 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s49 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m00 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY m01 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m02 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m03 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m04 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m05 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m06 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m07 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m08 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m09 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m10 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m11 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m12 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m13 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m14 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m15 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m16 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m17 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m18 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m19 NULL ALL NULL NULL NULL NULL 3 100.00 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; @@ -342,10 +342,10 @@ WHERE EMPNUM IN (SELECT EMPNUM FROM WORKS WHERE PNUM IN (SELECT PNUM FROM PROJ)); -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY STAFF NULL ALL NULL NULL NULL NULL 5 100.00 +1 PRIMARY PROJ NULL ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY WORKS NULL ALL NULL NULL NULL NULL 12 100.00 Using where; FirstMatch(STAFF) SELECT EMPNUM, EMPNAME FROM STAFF WHERE EMPNUM 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 20 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it1 NULL index NULL int_key 4 NULL 2 100.00 Using index +2 MATERIALIZED it2 NULL ALL int_key,datetime_key NULL NULL NULL 20 50.00 Using where DROP TABLE ot1, it1, it2; # End of BUG#38075 # @@ -938,15 +938,15 @@ WHERE t1field IN (SELECT * FROM v2) AND t1field IN (SELECT * FROM v3) "; EXECUTE stmt; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 100.00 Using index +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 100.00 Using index EXECUTE stmt; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 100.00 Using index +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 100.00 Using index DROP TABLE t1, t2, t3; DROP VIEW v2, v3; # End of Bug#49198 @@ -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 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 +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 <subquery3> NULL eq_ref distinct_key distinct_key 13 func 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 13 func 1 100.00 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index k k 10 NULL 4 100.00 Using where; Using index; Start temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 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 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 +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 4 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 4 100.00 Using where; Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 +2 DEPENDENT SUBQUERY t2inner NULL ALL NULL NULL NULL NULL 2 100.00 +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 +2 MATERIALIZED t2inner NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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; Start temporary +1 PRIMARY t2inner NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY ot3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY ot2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 DEPENDENT SUBQUERY it1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY ot3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY ot2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where +2 MATERIALIZED it1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 14 100.00 Using where +2 MATERIALIZED t1 NULL system NULL NULL NULL NULL 1 100.00 +2 MATERIALIZED b1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED b2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 <subquery2> NULL ALL distinct_key NULL NULL NULL 1 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 14 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED b1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED b2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL index PRIMARY PRIMARY 4 NULL 3 100.00 Using index +1 PRIMARY B NULL index NULL PRIMARY 4 NULL 3 100.00 Using index; Start temporary; End temporary +1 PRIMARY C NULL eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 100.00 Using index +1 PRIMARY D NULL eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A 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 B NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED C NULL ALL NULL NULL NULL NULL 3 100.00 +3 MATERIALIZED D NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL system NULL NULL NULL NULL 1 100.00 +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) +3 DERIVED NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 10 func 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 @@ -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 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 +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 2 100.00 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL b NULL NULL NULL 5 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t5 NULL index a a 10 NULL 2 100.00 Using index; Start temporary +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 +1 PRIMARY t2 NULL ALL b NULL NULL NULL 10 100.00 Using where +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 15 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY SQ3_alias1 NULL ALL NULL NULL NULL NULL 20 100.00 Start temporary +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY SQ3_alias2 NULL index NULL PRIMARY 4 NULL 20 100.00 Using index; End temporary +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (flat, BNL join) +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 13 100.00 Using where +2 MATERIALIZED t2 NULL ref b b 4 test.t3.a 1 100.00 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 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) +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 t2 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 t2 NULL ALL NULL NULL NULL NULL 6 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index idx idx 9 NULL 2 100.00 Using where; Using index; Start temporary +1 PRIMARY t3 NULL ref idx idx 4 test.t2.b 1 100.00 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index idx idx 9 NULL 2 100.00 Using where; Using index; Start temporary +1 PRIMARY t3 NULL ref idx idx 4 test.t2.b 1 100.00 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 2 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 <subquery2> NULL ALL distinct_key NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ref a a 5 const 1 100.00 Using index +1 PRIMARY t1 NULL ref a a 5 func 1 100.00 Using index +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 0 0.00 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 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 +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 index b b 5 NULL 10 50.00 Using where; Using index; LooseScan +1 PRIMARY t2 NULL ref c c 5 test.t1.b 1 100.00 Using where; FirstMatch(t1) +1 PRIMARY t1 NULL ref b b 5 test.t1.b 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 10 100.00 Using where; Using index; LooseScan +1 PRIMARY t2 NULL ref a a 5 test.t1.kp2 19 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 PRIMARY t1_2 NULL ALL NULL NULL NULL NULL 11 100.00 +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1_1.a 2 100.00 Using where; FirstMatch(t1_2) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 100.00 Using sort_union(PRIMARY,col_varchar_key); Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY alias2 NULL ALL col_int_key NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x2); End temporary SELECT * FROM t2 WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1 @@ -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 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 +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 ref f2 f2 5 const 0 0.00 Using where; Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 1462 100.00 Using index; FirstMatch(t1) +1 PRIMARY t2 NULL range idx idx 5 NULL 5 100.00 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 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) +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 +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 1462 100.00 Using index; FirstMatch(t1) +1 PRIMARY t2 NULL range idx idx 5 NULL 5 100.00 Using where; Using index; Using join buffer (flat, BNL join) drop table t1,t2; set optimizer_switch= @tmp_mdev12675; # @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 10000 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 500 100.00 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 77f10643e32..585904b0989 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL b NULL NULL NULL 20 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 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL 20 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 3 100.00 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 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 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL # 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func # 100.00 +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL # 100.00 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 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 +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 index b b 5 NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 32 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 32 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 52 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 52 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func 1 100.00 Using where +2 MATERIALIZED t1 NULL range a a 5 NULL 10 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ref a a 5 test.t1.a 1 100.00 Using index +2 MATERIALIZED t3 NULL ref a a 5 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range Population,Country Population 4 NULL 1 100.00 Using index condition; Rowid-ordered scan; Start temporary +1 PRIMARY t2 NULL eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 75.00 Using where; End temporary +1 PRIMARY t3 NULL eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 95.45 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 31 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL CountryCode NULL NULL NULL 545 100.00 Using where SELECT Name FROM t1 WHERE t1.Code IN ( SELECT t2.CountryCode FROM t2 WHERE Population > 5000000); @@ -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 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 +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 t3 NULL index PRIMARY PRIMARY 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 1000 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t3 NULL index a a 5 NULL 30000 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 FirstMatch((sj-nest)) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL const PRIMARY PRIMARY 4 const # 100.00 Using index +1 PRIMARY alias2 NULL index f12 f12 7 NULL # 100.00 Using index; LooseScan +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL # 100.00 Using index; FirstMatch(alias2) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL # 100.00 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +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 t1 NULL ref b b 4 test.t2.d 1 100.00 +2 MATERIALIZED t2 NULL index_merge PRIMARY,d d,PRIMARY 4,4 NULL 2 100.00 Using sort_union(d,PRIMARY); Using where +2 MATERIALIZED t1 NULL ref a a 5 test.t2.d 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL a NULL NULL NULL 38 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED alias1 NULL ALL a NULL NULL NULL 19 100.00 Using where +2 MATERIALIZED alias2 NULL ref a a 4 test.alias1.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # 100.00 Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # 100.00 Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # 100.00 Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # 100.00 Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # 100.00 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 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 +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 MATERIALIZED NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref PRIMARY PRIMARY 5 const 1 100.00 Using where; Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL index NULL PRIMARY 59 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY T3_0_ NULL ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 100.00 Using index; Start temporary +1 PRIMARY T2_1_ NULL eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 100.00 +1 PRIMARY T1_1_ NULL eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 100.00 Using index +1 PRIMARY T2_0_ NULL ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 100.00 Using index; End temporary drop table t3,t2,t1; set optimizer_search_depth=@tmp7474; # diff --git a/mysql-test/main/subselect_sj2_jcl6.result b/mysql-test/main/subselect_sj2_jcl6.result index 70ad99623cd..c5275a6cc45 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL b NULL NULL NULL 20 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 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL 20 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 3 100.00 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 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 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL # 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func # 100.00 +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL # 100.00 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 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 +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 index b b 5 NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 32 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 32 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 52 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 52 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func 1 100.00 Using where +2 MATERIALIZED t1 NULL range a a 5 NULL 10 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ref a a 5 test.t1.a 1 100.00 Using index +2 MATERIALIZED t3 NULL ref a a 5 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range Population,Country Population 4 NULL 1 100.00 Using index condition; Rowid-ordered scan; Start temporary +1 PRIMARY t2 NULL eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 75.00 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 95.45 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 31 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL CountryCode NULL NULL NULL 545 100.00 Using where SELECT Name FROM t1 WHERE t1.Code IN ( SELECT t2.CountryCode FROM t2 WHERE Population > 5000000); @@ -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 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 +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 hash_ALL NULL #hash#$hj 5 test.t1.a 3 100.00 Using where; Using join buffer (flat, BNLH join) +2 MATERIALIZED t3 NULL index PRIMARY PRIMARY 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 1000 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t3 NULL index a a 5 NULL 30000 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 FirstMatch((sj-nest)); Using join buffer (incremental, BNL join) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL const PRIMARY PRIMARY 4 const # 100.00 Using index +1 PRIMARY alias2 NULL index f12 f12 7 NULL # 100.00 Using index; LooseScan +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL # 100.00 Using index; FirstMatch(alias2) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL # 100.00 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t2 NULL hash_ALL NULL #hash#$hj 4 test.t3.a 1 100.00 Using where; Using join buffer (flat, BNLH join) +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +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 t1 NULL ref b b 4 test.t2.d 1 100.00 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 100.00 Using sort_union(d,PRIMARY); Using where +2 MATERIALIZED t1 NULL ref a a 5 test.t2.d 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL a NULL NULL NULL 38 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED alias1 NULL ALL a NULL NULL NULL 19 100.00 Using where +2 MATERIALIZED alias2 NULL ref a a 4 test.alias1.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # 100.00 Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # 100.00 Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # 100.00 Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # 100.00 Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # 100.00 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 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 +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 MATERIALIZED NULL 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref PRIMARY PRIMARY 5 const 1 100.00 Using where; Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Start temporary; 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) +1 PRIMARY t4 NULL hash_index NULL #hash#$hj:PRIMARY 54:59 test.t3.t3_c 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY T3_0_ NULL ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 100.00 Using index; Start temporary +1 PRIMARY T2_1_ NULL eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 100.00 Using join buffer (flat, BKA join); Key-ordered scan +1 PRIMARY T1_1_ NULL eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 100.00 Using index +1 PRIMARY T2_0_ NULL ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 100.00 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 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) +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL ref b b 4 test.t3.b 1 100.00 Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 100.00 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 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 2 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +2 MATERIALIZED t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.b 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL 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 ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY <subquery2> NULL hash_ALL distinct_key #hash#distinct_key 4 test.t1.b 1 100.00 Using join buffer (flat, BNLH join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 aee2dbacc15..901b5a2ac41 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL b NULL NULL NULL 20 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 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL 20 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 3 100.00 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 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 # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL b NULL NULL NULL # 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func # 100.00 +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL # 100.00 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 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 +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 index b b 5 NULL 20 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 32 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 32 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 52 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 22 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot NULL ALL NULL NULL NULL NULL 22 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it NULL ALL NULL NULL NULL NULL 52 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 10 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func 1 100.00 Using where +2 MATERIALIZED t1 NULL range a a 5 NULL 10 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ref a a 5 test.t1.a 1 100.00 Using index +2 MATERIALIZED t3 NULL ref a a 5 test.t1.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range Population,Country Population 4 NULL 1 100.00 Using index condition; Rowid-ordered scan; Start temporary +1 PRIMARY t2 NULL eq_ref PRIMARY,Population PRIMARY 3 test.t1.Country 1 75.00 Using where; End temporary +1 PRIMARY t3 NULL eq_ref PRIMARY,Percentage PRIMARY 33 test.t1.Country,const 1 95.45 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL PRIMARY NULL NULL NULL 31 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 3 func 1 100.00 +2 MATERIALIZED t2 NULL ALL CountryCode NULL NULL NULL 545 100.00 Using where SELECT Name FROM t1 WHERE t1.Code IN ( SELECT t2.CountryCode FROM t2 WHERE Population > 5000000); @@ -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 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 +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 t3 NULL index PRIMARY PRIMARY 4 NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index a a 5 NULL 1000 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t3 NULL index a a 5 NULL 30000 100.00 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 FirstMatch((sj-nest)) +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL const PRIMARY PRIMARY 4 const # 100.00 Using index +1 PRIMARY alias2 NULL index f12 f12 7 NULL # 100.00 Using index; LooseScan +1 PRIMARY t1 NULL index NULL PRIMARY 4 NULL # 100.00 Using index; FirstMatch(alias2) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL # 100.00 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 2 100.00 +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +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 t1 NULL ref b b 4 test.t2.d 1 100.00 +2 MATERIALIZED t2 NULL index_merge PRIMARY,d d,PRIMARY 4,4 NULL 2 100.00 Using sort_union(d,PRIMARY); Using where +2 MATERIALIZED t1 NULL ref a a 5 test.t2.d 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ALL a NULL NULL NULL 38 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED alias1 NULL ALL a NULL NULL NULL 19 100.00 Using where +2 MATERIALIZED alias2 NULL ref a a 4 test.alias1.a 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # 100.00 Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # 100.00 Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias3 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where +1 PRIMARY alias4 NULL ref PRIMARY,c c 4 test.alias3.d # 100.00 Using index +1 PRIMARY alias5 NULL eq_ref PRIMARY PRIMARY 4 test.alias4.b # 100.00 Using where; FirstMatch(alias3) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join) +1 PRIMARY alias1 NULL ALL NULL NULL NULL NULL # 100.00 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 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 +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 MATERIALIZED NULL 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ref PRIMARY PRIMARY 5 const 1 100.00 Using where; Using index +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL index NULL PRIMARY 59 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY T3_0_ NULL ref PRIMARY,FK_T3_T2Id PRIMARY 8 const 3 100.00 Using index; Start temporary +1 PRIMARY T2_1_ NULL eq_ref PRIMARY,FK_T2_T1Id PRIMARY 8 test.T3_0_.t2idref 1 100.00 +1 PRIMARY T1_1_ NULL eq_ref PRIMARY PRIMARY 8 test.T2_1_.t1idref 1 100.00 Using index +1 PRIMARY T2_0_ NULL ref FK_T2_T1Id FK_T2_T1Id 8 test.T2_1_.t1idref 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ref PRIMARY PRIMARY 5 const,const 5 100.00 Using index +1 PRIMARY t2 NULL ref cat_id cat_id 4 test.t3.cat_id 2 100.00 Using where; Using index; FirstMatch(t3) +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.cat_id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ref PRIMARY PRIMARY 5 const,const 5 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 100.00 Using index +2 MATERIALIZED t4 NULL index cat_id cat_id 4 NULL 19 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ref PRIMARY PRIMARY 5 const,const 5 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.cat_id 1 100.00 Using index +2 MATERIALIZED t2 NULL index cat_id cat_id 4 NULL 19 100.00 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 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range f1 f1 11 NULL 2 100.00 Using where; Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 11 func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL index PRIMARY PRIMARY 4 NULL 114 100.00 Using where; Using index +2 MATERIALIZED A NULL ALL PRIMARY NULL NULL NULL 114 100.00 +2 MATERIALIZED <subquery3> NULL eq_ref distinct_key distinct_key 67 func 1 100.00 +3 MATERIALIZED B NULL range PRIMARY PRIMARY 4 NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index PRIMARY PRIMARY 4 NULL 30 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t1 NULL eq_ref PRIMARY PRIMARY 4 test.t2.id 1 100.00 Using index +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 14 100.00 +2 MATERIALIZED t1 NULL eq_ref PRIMARY PRIMARY 4 test.t3.id 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL index PRIMARY PRIMARY 4 NULL 18 100.00 Using index +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t5 NULL ALL NULL NULL NULL NULL 18 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery4> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY <subquery6> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t4 NULL eq_ref PRIMARY PRIMARY 8 test.t3.id_product,const 1 100.00 Using where; Using index +1 PRIMARY <subquery5> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 Using where +1 PRIMARY t1 NULL index NULL PRIMARY 8 NULL 73 100.00 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 100.00 +4 MATERIALIZED t2_3 NULL range id_t2,id_product id_t2 5 NULL 33 100.00 Using index condition; Using where +6 MATERIALIZED t2_5 NULL range id_t2,id_product id_t2 5 NULL 31 100.00 Using index condition; Using where +2 MATERIALIZED t2_1 NULL ALL id_t2,id_product NULL NULL NULL 223 22.87 Using where +5 MATERIALIZED t2_4 NULL range id_t2,id_product id_t2 5 NULL 18 100.00 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 daf97cc008b..1d9c419af58 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 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 +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 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 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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t10 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 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 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 +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 index +1 PRIMARY t10 NULL eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 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 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 +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 select * from t1 where a in (select pk from t10 where t10.a in (select pk from t12)); a b 0 0 @@ -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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY s00 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY s01 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY s02 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s03 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s04 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s05 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s06 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s07 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s08 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s09 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s10 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s11 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s12 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s13 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s14 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s15 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s16 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s17 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s18 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s19 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s20 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s21 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s22 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s23 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s24 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s25 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s26 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s27 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s28 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s29 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s30 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s31 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s32 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s33 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s34 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s35 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s36 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s37 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s38 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s39 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s40 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s41 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s42 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s43 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s44 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s45 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s46 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s47 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s48 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY s49 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m00 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 DEPENDENT SUBQUERY m01 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY m02 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m03 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m04 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m05 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m06 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m07 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m08 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m09 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m10 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m11 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m12 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m13 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m14 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m15 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m16 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m17 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m18 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY m19 NULL ALL NULL NULL NULL NULL 3 100.00 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; @@ -353,10 +353,10 @@ WHERE EMPNUM IN (SELECT EMPNUM FROM WORKS WHERE PNUM IN (SELECT PNUM FROM PROJ)); -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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY STAFF NULL ALL NULL NULL NULL NULL 5 100.00 +1 PRIMARY PROJ NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) +1 PRIMARY WORKS NULL ALL NULL NULL NULL NULL 12 100.00 Using where; FirstMatch(STAFF); Using join buffer (incremental, BNL join) SELECT EMPNUM, EMPNAME FROM STAFF WHERE EMPNUM 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 20 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED it1 NULL index NULL int_key 4 NULL 2 100.00 Using index +2 MATERIALIZED it2 NULL ALL int_key,datetime_key NULL NULL NULL 20 50.00 Using where; Using join buffer (flat, BNL join) DROP TABLE ot1, it1, it2; # End of BUG#38075 # @@ -949,15 +949,15 @@ WHERE t1field IN (SELECT * FROM v2) AND t1field IN (SELECT * FROM v3) "; EXECUTE stmt; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 100.00 Using index +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 100.00 Using index EXECUTE stmt; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index PRIMARY PRIMARY 4 NULL 2 100.00 Using index +1 PRIMARY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 100.00 Using index +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t1.t1field 1 100.00 Using index DROP TABLE t1, t2, t3; DROP VIEW v2, v3; # End of Bug#49198 @@ -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 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 +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 <subquery3> NULL eq_ref distinct_key distinct_key 13 func 1 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 13 func 1 100.00 +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 5 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 6 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index k k 10 NULL 4 100.00 Using where; Using index; Start temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 100.00 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 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) +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 4 100.00 Using where +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 4 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 +2 DEPENDENT SUBQUERY t2inner NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 +2 MATERIALIZED t2inner NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2inner NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY ot3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY ot2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +2 DEPENDENT SUBQUERY it1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ot1 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY ot3 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY ot2 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (incremental, BNL join) +2 MATERIALIZED it1 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 14 100.00 Using where +2 MATERIALIZED t1 NULL system NULL NULL NULL NULL 1 100.00 +2 MATERIALIZED b1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED b2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 <subquery2> NULL ALL distinct_key NULL NULL NULL 1 100.00 +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 14 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED b1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +2 MATERIALIZED b2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A NULL index PRIMARY PRIMARY 4 NULL 3 100.00 Using index +1 PRIMARY B NULL index NULL PRIMARY 4 NULL 3 100.00 Using index; FirstMatch(A); Using join buffer (flat, BNL join) +1 PRIMARY C NULL eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 100.00 Using index +1 PRIMARY D NULL eq_ref PRIMARY PRIMARY 4 test.A.t1field 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY A 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 B NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY <subquery3> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED C NULL ALL NULL NULL NULL NULL 3 100.00 +3 MATERIALIZED D NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived3> NULL system NULL NULL NULL NULL 1 100.00 +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) +3 DERIVED NULL 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 8 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 10 func 1 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using where; Start temporary; Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 @@ -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 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) +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 2 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) +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index; Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL b NULL NULL NULL 5 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t5 NULL index a a 10 NULL 2 100.00 Using index; Start temporary +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join) +1 PRIMARY t2 NULL ALL b NULL NULL NULL 10 100.00 Using where; Using join buffer (incremental, BNL join) +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 15 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY SQ3_alias1 NULL ALL NULL NULL NULL NULL 20 100.00 Start temporary +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 20 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY SQ3_alias2 NULL index NULL PRIMARY 4 NULL 20 100.00 Using index; End temporary; Using join buffer (incremental, BNL join) +1 PRIMARY alias2 NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (incremental, BNL join) +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 20 100.00 Using join buffer (incremental, BNL join) +2 DERIVED t2 NULL ALL NULL NULL NULL NULL 20 100.00 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 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 +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 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 13 100.00 Using where +2 MATERIALIZED t2 NULL ref b b 4 test.t3.a 1 100.00 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 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) +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 t2 NULL ALL NULL NULL NULL NULL 6 100.00 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 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 +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 t2 NULL ALL NULL NULL NULL NULL 6 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index idx idx 9 NULL 2 100.00 Using where; Using index; Start temporary +1 PRIMARY t3 NULL ref idx idx 4 test.t2.b 1 100.00 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL index idx idx 9 NULL 2 100.00 Using where; Using index; Start temporary +1 PRIMARY t3 NULL ref idx idx 4 test.t2.b 1 100.00 Using index +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 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 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 +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 2 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 <subquery2> NULL ALL distinct_key NULL NULL NULL 1 100.00 +1 PRIMARY t2 NULL ref a a 5 const 1 100.00 Using index +1 PRIMARY t1 NULL ref a a 5 func 1 100.00 Using index +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 0 0.00 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 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 +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 index b b 5 NULL 10 50.00 Using where; Using index; LooseScan +1 PRIMARY t2 NULL ref c c 5 test.t1.b 1 100.00 Using where; FirstMatch(t1) +1 PRIMARY t1 NULL ref b b 5 test.t1.b 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 10 100.00 Using where; Using index; LooseScan +1 PRIMARY t2 NULL ref a a 5 test.t1.kp2 19 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 100 100.00 Using where +1 PRIMARY t1 NULL ref kp1 kp1 5 test.t3.a 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1_1 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +1 PRIMARY t1_2 NULL ALL NULL NULL NULL NULL 11 100.00 +1 PRIMARY <derived3> NULL ref key0 key0 5 test.t1_1.a 2 100.00 Using where; FirstMatch(t1_2) +3 DERIVED t1 NULL ALL NULL NULL NULL NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY alias1 NULL index_merge PRIMARY,col_int_key,col_varchar_key PRIMARY,col_varchar_key 4,4 NULL 2 100.00 Using sort_union(PRIMARY,col_varchar_key); Using where; Start temporary +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY alias2 NULL ALL col_int_key NULL NULL NULL 12 100.00 Range checked for each record (index map: 0x2); End temporary SELECT * FROM t2 WHERE (field1) IN (SELECT alias1.col_varchar_nokey AS field1 @@ -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 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 +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 ref f2 f2 5 const 0 0.00 Using where; Using index +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join) +2 DEPENDENT SUBQUERY t4 NULL ALL NULL NULL NULL NULL 2 100.00 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 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) +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 +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 1462 100.00 Using index; FirstMatch(t1) +1 PRIMARY t2 NULL range idx idx 5 NULL 5 100.00 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 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) +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 +1 PRIMARY t2 NULL ref idx idx 5 test.t1.a 1462 100.00 Using index; FirstMatch(t1) +1 PRIMARY t2 NULL range idx idx 5 NULL 5 100.00 Using where; Using index; Using join buffer (flat, BNL join) drop table t1,t2; set optimizer_switch= @tmp_mdev12675; # @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 10000 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 100.00 +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 500 100.00 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 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 +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 t1 NULL ref a a 5 test.t0.a 1 100.00 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 100.00 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 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) +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 PRIMARY NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL d NULL NULL NULL 5 100.00 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 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) +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 PRIMARY NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL ALL d NULL NULL NULL 5 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL idx_a NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +1 PRIMARY t2 NULL ref idx_c idx_c 4 test.t1.b 2 100.00 Using where; Using index +2 MATERIALIZED t NULL ALL idx_a NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL idx_a NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +1 PRIMARY t3 NULL ref idx_c idx_c 4 test.t1.b 2 100.00 Using where +2 MATERIALIZED t NULL ALL idx_a NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL idx_a NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +1 PRIMARY t2 NULL ref idx_c idx_c 4 test.t1.b 2 100.00 Using where; Using index +2 MATERIALIZED t NULL ALL idx_a NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL idx_a NULL NULL NULL 3 100.00 +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +1 PRIMARY t3 NULL ref idx_c idx_c 4 test.t1.b 2 100.00 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +2 MATERIALIZED t NULL ALL idx_a NULL NULL NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL range idx_a idx_a 4 NULL 3 100.00 Using where; 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 2 100.00 Using where +2 MATERIALIZED t1 NULL ref idx_a idx_a 4 test.t2.b 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL range idx_a idx_a 4 NULL 3 100.00 Using where; 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 2 100.00 Using where +2 MATERIALIZED t1 NULL ref idx_a idx_a 4 test.t2.b 2 100.00 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 ae3296e48e8..69bf04d68fc 100644 --- a/mysql-test/main/subselect_sj_mat.result +++ b/mysql-test/main/subselect_sj_mat.result @@ -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 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 +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 execute st1; -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 +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 prepare st2 from "select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1)"; execute st2; a1 a2 @@ -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 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 +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 <subquery2> NULL const distinct_key distinct_key 4 const 1 100.00 +2 MATERIALIZED NULL 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 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 +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 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 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 +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 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 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 +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 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 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 +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 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 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 +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 2 func 1 100.00 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 <subquery3> 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; Start temporary; End temporary; Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 matching row in const table +3 MATERIALIZED NULL 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 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 +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 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 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 +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 7 func,func 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t0 NULL ALL NULL NULL NULL NULL 3 100.00 +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 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 @@ -1927,8 +1927,8 @@ SELECT alias3.c FROM t2 AS alias3, t2 AS alias4 WHERE alias4.c = alias3.b ); -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 +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 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 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 +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 +2 MATERIALIZED t2 NULL ALL i_a NULL NULL NULL 8 100.00 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 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 +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 <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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'; @@ -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 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 +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 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 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 +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 index c c 5 NULL 8 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED s2 NULL ref d d 4 const 2 100.00 Using where; Using index +2 MATERIALIZED s1 NULL ALL c NULL NULL NULL 8 100.00 Using where; Using join buffer (flat, BNL join) +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +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 index c c 5 NULL 8 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 func,func 1 100.00 +2 MATERIALIZED s2 NULL ref d d 4 const 2 100.00 Using where; Using index +2 MATERIALIZED s1 NULL hash_ALL c #hash#$hj 5 const 8 100.00 Using where; Using join buffer (flat, BNLH join) +3 SUBQUERY t2 NULL ALL NULL NULL NULL NULL 8 100.00 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)); @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY sq1 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 sq2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (flat, BNL join) +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 2 100.00 # this checks the result set above set optimizer_switch= 'materialization=off,semijoin=off'; SELECT sq1.f2 FROM t1 AS sq1 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t2 NULL ref idx3,idx4 idx4 35 const 2 100.00 Using index condition; Using where; Start temporary +1 PRIMARY t3_i NULL eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 100.00 Using index condition; Using where +1 PRIMARY t1 NULL ref idx1,idx2 idx1 35 test.t3_i.sys_id 2 100.00 Using index condition; Using where; End temporary +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 100.00 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 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 +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 t1 NULL ref idx1,idx2 idx1 35 test.t2.ugroup 2 100.00 Using where +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 32 test.t1.assignment_group 1 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ref idx3,idx4 idx4 35 const 2 100.00 Using index condition; Using where +2 MATERIALIZED t3_i NULL eq_ref PRIMARY PRIMARY 32 test.t2.ugroup 1 100.00 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 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 +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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index id id 4 NULL 9 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 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index id id 4 NULL 9 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 3 100.00 Using where SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1); 1 1 @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 1000 100.00 Using where +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 4000 100.00 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_nonmerged.result b/mysql-test/main/subselect_sj_nonmerged.result index b96b00fc80a..0897178a6df 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 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 +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 t0 NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +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 t3 NULL eq_ref PRIMARY PRIMARY 8 <subquery2>.max(t2.a) 1 100.00 Using where; Using index +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL index PRIMARY PRIMARY 8 NULL 100 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t3.a 1 100.00 Using where +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL index PRIMARY PRIMARY 8 NULL 100 100.00 Using index +1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t3.a 1 100.00 Using where +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 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 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) +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 t0 NULL ALL NULL NULL NULL NULL 10 100.00 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 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <subquery3> NULL ALL distinct_key NULL NULL NULL 5 100.00 +1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +1 PRIMARY t4 NULL eq_ref a a 10 <subquery2>.max(t2.a),<subquery3>.max(t2.a) 1 100.00 +3 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary +3 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using temporary +2 MATERIALIZED t1 NULL ALL NULL NULL NULL NULL 10 100.00 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 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 +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 X NULL ref a a 5 <subquery2>.max(a) 1 100.00 Using index +1 PRIMARY Y NULL ALL NULL NULL NULL NULL 10 100.00 Using where; Using join buffer (flat, BNL join) +2 MATERIALIZED t0 NULL ALL NULL NULL NULL NULL 10 100.00 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 8fdcb094a7a..a7bbad7a348 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 2 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 2 100.00 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 64fe35f4209..00ddb31f0c2 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 2 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 2 100.00 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 7fff48f9e9e..355c43fe93d 100644 --- a/mysql-test/main/table_elim.result +++ b/mysql-test/main/table_elim.result @@ -11,8 +11,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain extended select t1.a from t1 left join t2 on t2.a=t1.a; 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 @@ -26,32 +26,32 @@ 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 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 +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 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 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 +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 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 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 +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 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 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 +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 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 # 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 # Elimination when done within an outer join nest: explain extended select t0.* @@ -65,19 +65,19 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain select count(1) from t1 left join t2 on t2.a=t1.a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain select count(1) from t1 left join t2 on t2.a=t1.a group by t1.a; -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 +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 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 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 +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 +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using where; Using index drop table t0, t1, t2, t3; create table t0 ( id integer, primary key (id)); create table t1 ( @@ -118,8 +118,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 PRIMARY f NULL const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY f NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index This should use one table: explain extended select id from v1 where id in (1,2,3,4); id select_type table partitions type possible_keys key key_len ref rows filtered Extra @@ -146,8 +146,8 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 PRIMARY f NULL const PRIMARY PRIMARY 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY f NULL const PRIMARY PRIMARY 4 const 1 100.00 Using index This should use one table: explain extended select id from v2 where id in (1,2,3,4); id select_type table partitions type possible_keys key key_len ref rows filtered Extra @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 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 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 +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 ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 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 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 +id select_type 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 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 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 +id select_type 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 eq_ref PRIMARY PRIMARY 4 test.t1.col 1 100.00 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 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 +id select_type 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 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 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 +id select_type 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 eq_ref PRIMARY PRIMARY 4 test.t1.col 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 10 NULL 2 100.00 Using index +1 SIMPLE t2 NULL index PRIMARY PRIMARY 10 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 10 NULL 2 100.00 Using index +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index +1 SIMPLE t2 NULL index PRIMARY PRIMARY 10 NULL 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 10 NULL 2 100.00 Using index +1 SIMPLE t2 NULL eq_ref a a 3 test.t1.a 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain select t1.a from t1 left join t2 on t2.pk=t1.a or t2.b<t1.b; -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 +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 PRIMARY NULL NULL NULL 2 100.00 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 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 +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 PRIMARY NULL NULL NULL 2 100.00 Using where explain select t1.a from t1 left join t2 on t2.pk between 10 and 20; -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 +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 range PRIMARY PRIMARY 4 NULL 1 100.00 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 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 +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 range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index explain select t1.a from t1 left join t2 on t2.pk between 10 and 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain select t1.a from t1 left join t2 on t2.pk in (10); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain select t1.a from t1 left join t2 on t2.pk in (t1.a); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain select t1.a from t1 left join t2 on TRUE; -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 +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 index NULL PRIMARY 4 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 #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 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 +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 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain select t1.* from t1 left join t2 on t2.pk=3 or t2.pk= 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 -1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 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 4 100.00 +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using index explain select t1.* from t1 left join t2 on t2.pk=3 or t2.pk= 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 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 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 +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 range PRIMARY PRIMARY 4 NULL 2 100.00 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 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) +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 Using where +1 SIMPLE t5 NULL ref f5 f5 5 test.t3.f1 2 100.00 Using where; Using index +1 SIMPLE t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +1 SIMPLE t2 NULL ALL f4 NULL NULL NULL 11 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 SIMPLE t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index drop view v1; DROP TABLE t1,t2,t3; # diff --git a/mysql-test/main/table_elim_debug.result b/mysql-test/main/table_elim_debug.result index 6253d64f6e4..27f5c001b11 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 set optimizer_switch='table_elimination=off'; explain select t1.a from t1 left join t2 on t2.a=t1.a; -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 +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 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 set optimizer_switch='table_elimination=default'; explain select t1.a from t1 left join t2 on t2.a=t1.a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 drop table t1, t2; diff --git a/mysql-test/main/table_value_constr.result b/mysql-test/main/table_value_constr.result index 4450b3b5dc2..b23aaadd075 100644 --- a/mysql-test/main/table_value_constr.result +++ b/mysql-test/main/table_value_constr.result @@ -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 partitions type possible_keys key key_len ref rows 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 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 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 +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 explain values (1,2),(3,4) union select 1,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 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 +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 explain values (5,6) union values (1,2),(3,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 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> NULL ALL 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 explain format=json select 1,2 union @@ -1446,11 +1446,11 @@ union values (3,4) union values (1,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 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 +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 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 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 +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 explain values (1,2),(3,4) union all select 1,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 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 explain values (1,2) union all values (1,2),(3,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 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 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 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 +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 explain 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 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 +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 NULL 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 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 +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 NULL 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 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 +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 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 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 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 +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 NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION t1 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL drop table t1; # # MDEV-16930: expression in the first row of TVC specifying derived table @@ -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 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 +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 ALL NULL NULL NULL NULL 3 100.00 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 ALL NULL NULL NULL NULL 3 100.00 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 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 +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 +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 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 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 +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 +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 +3 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 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 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 +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 +6 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 +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +3 SUBQUERY <derived5> NULL ref key0 key0 8 test.t3.a 2 100.00 Using where; FirstMatch(t3) +5 DERIVED t3 NULL ALL NULL NULL NULL NULL 11 100.00 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 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 +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 +6 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 +3 SUBQUERY t3 NULL ALL NULL NULL NULL NULL 11 100.00 Using where +3 SUBQUERY <derived5> NULL ref key0 key0 8 test.t3.a 2 100.00 Using where; FirstMatch(t3) +5 DERIVED t3 NULL ALL NULL NULL NULL NULL 11 100.00 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/tmp_table_count-7586.result b/mysql-test/main/tmp_table_count-7586.result index e47c0a23c96..3aff6d8a244 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 +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 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 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 +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 <subquery2> NULL eq_ref distinct_key distinct_key 4 test.t1.a 1 100.00 +2 MATERIALIZED t2 NULL ALL NULL NULL NULL NULL 2 100.00 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 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 +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 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 6a89724d02c..c76171744b7 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 2 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 2 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 38 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 38 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 38 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 38 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 38 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 38 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 2 NULL 27 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 2 NULL 9 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range NULL a 3 NULL 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 2 NULL 4 100.00 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 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 +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 EXPLAIN SELECT * FROM t1 WHERE a<=>200; -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 +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 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 ff333f4eeef..3778ca9c05e 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 2 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 2 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 38 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 38 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 38 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 38 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 5 NULL 38 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 38 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 2 NULL # 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 2 NULL 9 100.00 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_blob.result b/mysql-test/main/type_blob.result index 80579c54708..414d2f100e4 100644 --- a/mysql-test/main/type_blob.result +++ b/mysql-test/main/type_blob.result @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null txt_index txt_index 23 const 3 100.00 Using where explain select * from t1 FORCE INDEX (`txt_index`) where txt='Chevy' or txt is NULL; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null txt_index txt_index 23 const 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null txt_index txt_index 23 const 2 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref_or_null txt_index txt_index 23 const 2 100.00 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 partitions type possible_keys key key_len ref rows 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 explain select cast(1 as nchar(4294967295)); -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 +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 explain select cast(1 as binary(4294967295)); -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 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 d333813ccca..3b8d8447602 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 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 +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 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 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 +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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref i i 4 const 2 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i i 4 const 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref i i 4 const 2 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i i 4 const 2 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1_0 NULL ref a a 4 const 1 100.00 Using where; Using index +1 SIMPLE t2 NULL index NULL a 4 NULL 2 100.00 Using index; Using join buffer (flat, BNL join) +1 SIMPLE t1 NULL index NULL a 4 NULL 2 100.00 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 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 +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 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; @@ -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 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 +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 EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP('2001-01-01', '00:00:01') AND TRUE; -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 +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 EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP'2001-01-01 00:00:00' AND TRUE; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 4 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 4 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 4 const 1 100.00 Using where; Using index DROP TABLE t1; # # End of 10.3 tests diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result index 3d22729f667..a4a3f1f254b 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref expedition expedition 5 const 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref expedition expedition 5 const 2 100.00 drop table t1; create table t1 (a datetime not null, b datetime not null); insert into t1 values (now(), now()); @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL const PRIMARY PRIMARY 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL const PRIMARY PRIMARY 5 const 1 100.00 Using index DROP TABLE t1,t2; # # Bug#57095: Wrongly chosen expression cache type led to a wrong @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 6 NULL 4 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 6 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 7 NULL 4 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 7 NULL 4 100.00 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 diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result index 486ddab3c24..4b7d382e9ce 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 26 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 26 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 14 NULL 26 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 14 NULL 26 100.00 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 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 +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 index PRIMARY PRIMARY 8 NULL 2 100.00 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 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 +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 index PRIMARY PRIMARY 8 NULL 2 100.00 Using where; Using index DROP TABLE t1,t2; # # End of 10.0 tests diff --git a/mysql-test/main/type_int.result b/mysql-test/main/type_int.result index 3642dc92057..3630ce613a5 100644 --- a/mysql-test/main/type_int.result +++ b/mysql-test/main/type_int.result @@ -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 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 +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 EXPLAIN SELECT * FROM t1 WHERE a<=>200; -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 +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 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 partitions type possible_keys key key_len ref rows 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 SELECT COUNT(*) FROM t1 WHERE a!=a; COUNT(*) 0 EXPLAIN SELECT * FROM t1 WHERE a>a; -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 +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 SELECT COUNT(*) FROM t1 WHERE a>a; COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a<a; -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 +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 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 partitions type possible_keys key key_len ref rows 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 SELECT COUNT(*) FROM t1 WHERE a!=a; COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a>a; -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 +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 SELECT COUNT(*) FROM t1 WHERE a>a; COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a<a; -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 +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 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 partitions type possible_keys key key_len ref rows 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 SELECT COUNT(*) FROM t1 WHERE not (a!=a); COUNT(*) 3 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a>a-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 Using where +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 SELECT COUNT(*) FROM t1 WHERE a>a-1; COUNT(*) 3 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a<a+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 Using where +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 SELECT COUNT(*) FROM t1 WHERE a<a+1; COUNT(*) 3 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a-1<a; -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 +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 SELECT COUNT(*) FROM t1 WHERE a-1<a; COUNT(*) 3 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a NOT LIKE a; -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 +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 SELECT COUNT(*) FROM t1 WHERE a NOT LIKE a; COUNT(*) 0 EXPLAIN SELECT COUNT(*) FROM t1 WHERE a XOR a; -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 +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 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 ee38bc2a81e..f10d00e1154 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 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 +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 index PRIMARY PRIMARY 14 NULL 2 100.00 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 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 +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 index PRIMARY PRIMARY 14 NULL 2 100.00 Using where; Using index DROP TABLE t1,t2; # # End of 10.0 tests @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 6 const 1 100.00 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 9f9de640f5e..9b0d28ef186 100644 --- a/mysql-test/main/type_time.result +++ b/mysql-test/main/type_time.result @@ -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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 4 NULL 4 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 4 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 4 NULL 4 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 4 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 4 NULL 4 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 4 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 4 NULL 4 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 4 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 4 NULL 4 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 4 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 4 NULL 4 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 4 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 4 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 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 4 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 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 4 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 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 5 NULL 4 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 4 100.00 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 diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result index 1c1fb6ade90..cd252989790 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 partitions type possible_keys key key_len ref rows Extra -x x x x range x x x x x x +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x x x range x 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 partitions type possible_keys key key_len ref rows Extra -x x x x range x x x x x x +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x x x x range x 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 @@ -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 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 +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: 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 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 +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: 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 670cbc31493..c09087ef6ac 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 4 x 6 x 7 x 8 x 9 x 10 x 11 x +--replace_column 1 x 2 x 3 x 4 x 6 x 7 x 8 x 9 x 10 x 11 x 12 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 4 x 6 x 7 x 8 x 9 x 10 x 11 x +--replace_column 1 x 2 x 3 x 4 x 6 x 7 x 8 x 9 x 10 x 11 x 12 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 cbdbdc924d6..6a7a17bd62e 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 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 +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 index PRIMARY PRIMARY 4 NULL 2 100.00 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 dca679e5bf5..143769b314a 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 257 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 257 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 257 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 257 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 258 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 258 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 258 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 258 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 259 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 259 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 259 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 259 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 260 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 260 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 260 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 260 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 261 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 261 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 261 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 261 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 262 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 262 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 262 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 262 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 261 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 261 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 261 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 261 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 260 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 260 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 260 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 260 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 259 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 259 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 259 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 259 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 258 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 258 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 258 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 258 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 257 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 257 NULL 3 100.00 Using where; Using index explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 257 const 3 100.00 Using where; Using index explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 257 NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range v v 13 NULL 4 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 13 NULL 4 100.00 Using where; Using filesort explain select * from t1 where v='This is a test' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const 4 100.00 Using where explain select * from t1 where v like 'S%' order by v; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 13 NULL 3 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL index PRIMARY PRIMARY 22 NULL 2 100.00 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 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 +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 index PRIMARY PRIMARY 22 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 22 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 22 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY PRIMARY 22 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY PRIMARY 22 const 1 100.00 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 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 +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 const PRIMARY PRIMARY 12 const 1 100.00 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 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 +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 const PRIMARY PRIMARY 12 const 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 DROP TABLE t1,t2; # # End of 10.0 tests diff --git a/mysql-test/main/udf.result b/mysql-test/main/udf.result index 842c0b8b507..68b38518b7b 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 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 drop table t1; CREATE TABLE t1(a INT, b INT); INSERT INTO t1 values (1,1),(2,2); diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result index c425b16b3c8..ebdf90de4a6 100644 --- a/mysql-test/main/union.result +++ b/mysql-test/main/union.result @@ -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 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 +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 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 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 +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 t1 NULL ALL NULL NULL NULL NULL 4 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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"); @@ -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 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 +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 UNION t1 NULL index PRIMARY PRIMARY 4 NULL 4 100.00 Using index +2 UNION t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 Using index +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +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 t1 NULL ref b b 5 const 1 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 ); @@ -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 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 +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 ALL NULL NULL NULL NULL 4 100.00 Using temporary +3 UNION t1 NULL ALL NULL NULL NULL NULL 4 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL 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 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 +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 +2 SUBQUERY t4 NULL eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where +3 SUBQUERY t2 NULL ref PRIMARY PRIMARY 4 const 4 100.00 Using index +4 UNION t2 NULL ref PRIMARY PRIMARY 4 func 1 100.00 Using where; Using index +5 SUBQUERY NULL 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 NULL Impossible WHERE noticed after reading const tables +NULL UNION RESULT <union3,4> NULL ALL NULL 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 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 +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 # Bug #17579498 CHANGES IN DATATYPE OF THE RESULT QUERY IN UNION. CREATE TABLE t1 (a TIME); CREATE TABLE t2 (b DATETIME); diff --git a/mysql-test/main/update.result b/mysql-test/main/update.result index 41fc206e75e..f653edfc10c 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range key1 key1 5 NULL 2 Using where; Using buffer +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range key1 key1 5 NULL 2 100.00 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 726b4c4ef6d..8eff6857187 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 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 +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 a NULL ALL NULL NULL NULL NULL 8 100.00 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 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) +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 a NULL ALL NULL NULL NULL NULL 8 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range t1_c2 t1_c2 5 NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY a NULL ref t1_c2 t1_c2 5 test.t1.c2 4 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL t1_c2 NULL NULL NULL 8 100.00 Using where +1 PRIMARY a NULL ref t1_c2 t1_c2 10 test.t1.c2,test.t1.c1 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range t1_c2 t1_c2 5 NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY a NULL ref t1_c2 t1_c2 5 test.t1.c2 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL t1_c2 NULL NULL NULL 8 100.00 Using where +1 PRIMARY a NULL ref t1_c2 t1_c2 10 test.t1.c2,test.t1.c1 1 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL range t1_c2 t1_c2 5 NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY a NULL ref t1_c2 t1_c2 5 test.t1.c2 1 100.00 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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL t1_c2 NULL NULL NULL 8 100.00 Using where +1 PRIMARY a NULL ref t1_c2 t1_c2 10 test.t1.c2,test.t1.c1 1 100.00 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 a6ebd7f1237..ca9f45f9449 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref i i 4 const 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i i 4 const 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 Using where +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 explain select @vv1:=i from t1 where i=@vv1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL i 4 NULL 3 100.00 Using where; Using index explain select * from t1 where i=@vv1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref i i 4 const 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i i 4 const 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 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 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 partitions type possible_keys key key_len ref rows 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 # # Start of 10.3 tests # diff --git a/mysql-test/main/variables.result b/mysql-test/main/variables.result index 346ca4b44dc..d715d2bd7a3 100644 --- a/mysql-test/main/variables.result +++ b/mysql-test/main/variables.result @@ -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 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 +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 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 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 +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 temporary +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where SELECT 1 as 'one' FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE f1 = 0); one 1 diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index 4620f9dd825..8c224acb4f1 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -233,9 +233,9 @@ a 2 3 explain select * from v1; -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 +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 Using temporary select * from t1; a 1 @@ -298,9 +298,9 @@ a+1 5 4 explain select * from v1; -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 +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 4 100.00 Using filesort drop view v1; drop table t1; create table t1 (a int); @@ -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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 Using where; Using index +1 SIMPLE t2 NULL ref a a 10 const,test.t1.b 1 100.00 Using index EXPLAIN SELECT * FROM v1 WHERE a=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 Using where; Using index -1 SIMPLE t2 NULL ref a a 10 const,test.t1.b 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 Using where; Using index +1 SIMPLE t2 NULL ref a a 10 const,test.t1.b 1 100.00 Using index EXPLAIN SELECT * FROM v2 WHERE a=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 Using index -1 SIMPLE t3 NULL 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 filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 Using index +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 3 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 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 2 100.00 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 partitions type possible_keys key key_len ref rows 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 EXPLAIN SELECT MAX(a) FROM v1; -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 +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 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 partitions type possible_keys key key_len ref rows 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 EXPLAIN SELECT MIN(a) FROM v1; -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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 EXPLAIN SELECT * FROM v1; -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 +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL NULL NULL NULL NULL 3 100.00 Using where +2 SUBQUERY t1 NULL ALL NULL NULL NULL NULL 3 100.00 EXPLAIN SELECT * FROM v1 t WHERE t.s1+1 < (SELECT MAX(t1.s1) FROM t1); -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 +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 t1 NULL ALL NULL NULL NULL NULL 3 100.00 DROP VIEW v1; DROP TABLE t1; create table t1 (s1 int); @@ -3339,30 +3339,30 @@ a 2 3 EXPLAIN SELECT * FROM t1 UNION SELECT * FROM v1; -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 +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 UNION t1 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +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 UNION t1 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL 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 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 +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 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using where +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 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE profile NULL const PRIMARY PRIMARY 4 const 1 100.00 Using temporary; Using filesort +1 SIMPLE userrole NULL ref idx_person_id,idx_role_id idx_person_id 4 const 2 100.00 +1 SIMPLE role NULL eq_ref PRIMARY PRIMARY 4 test.userrole.role_id 1 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 15 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 15 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 15 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 15 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 DROP VIEW v1; DROP VIEW v2; DROP VIEW v3; @@ -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 partitions type possible_keys key key_len ref rows 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 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 @@ -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 partitions type possible_keys key key_len ref rows 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 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 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) +id select_type 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 2 100.00 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 @@ -5728,9 +5728,9 @@ ON t36.f36 = t59.f59 LEFT JOIN v60 ON t36.f36 = v60.f60 ; -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 +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 NULL 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, diff --git a/mysql-test/main/view_grant.result b/mysql-test/main/view_grant.result index f548637027a..36b598cd565 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 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 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 +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 0 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL system NULL NULL NULL NULL 0 Const row not found +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 select * from v3; k explain select * from v3; -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 +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 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 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 +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 +1 SIMPLE t2 NULL system NULL NULL NULL NULL 0 0.00 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 df66da9dd1a..12175ca2c4a 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using temporary +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 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 partitions type possible_keys key key_len ref rows 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 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 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 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary +id select_type 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 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 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 +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 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 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 +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 (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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary +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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary +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 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 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 +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; 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 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 +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 Using temporary +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 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 partitions type possible_keys key key_len ref rows 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 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 partitions type possible_keys key key_len ref rows 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 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 17a10e9c8d3..94ca02bbeb5 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 1000 100.00 +2 DERIVED test_table NULL ALL NULL NULL NULL NULL 1000 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 100000 100.00 +2 DERIVED test_table NULL ALL NULL NULL NULL NULL 100000 100.00 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 94c39234fd4..685ef8fa1f4 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 10 100.00 Using temporary +2 SUBQUERY t1 NULL const PRIMARY PRIMARY 4 const 1 100.00 select a from t1; a 0 diff --git a/mysql-test/main/xtradb_mrr.result b/mysql-test/main/xtradb_mrr.result index 19461e00160..ceb98f2c7d5 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 16 2.86 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 32 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 9 NULL 100 100.00 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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range d d 5 NULL # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 1 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 5 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 5 NULL 1 100.00 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/suite/archive/rnd_pos.result b/mysql-test/suite/archive/rnd_pos.result index b6b6748d53f..f21a294d0f3 100644 --- a/mysql-test/suite/archive/rnd_pos.result +++ b/mysql-test/suite/archive/rnd_pos.result @@ -1,12 +1,12 @@ create table t1(c1 int not null, c2 double not null, c3 char(255) not null) engine=archive; insert t1 select seq, seq+0.7, concat('row with c1 = ', seq) from seq_1_to_10; explain partitions select c1,c3 from t1 order by c2; -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 +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 set max_length_for_sort_data = 4; explain partitions select c1,c3 from t1 order by c2; -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; 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 temporary; Using filesort flush status; select c1,c3 from t1 order by c2; c1 c3 @@ -28,12 +28,12 @@ Handler_tmp_write 10 Rows_tmp_read 20 alter table t1 partition by hash (c1) partitions 3; explain partitions select c1,c3 from t1 order by c2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 100.00 Using filesort set max_length_for_sort_data = 4; explain partitions select c1,c3 from t1 order by c2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 100.00 Using temporary; Using filesort flush status; select c1,c3 from t1 order by c2; c1 c3 diff --git a/mysql-test/suite/compat/oracle/r/sp-row.result b/mysql-test/suite/compat/oracle/r/sp-row.result index 048cf77090e..671beb356e6 100644 --- a/mysql-test/suite/compat/oracle/r/sp-row.result +++ b/mysql-test/suite/compat/oracle/r/sp-row.result @@ -3099,8 +3099,8 @@ BEGIN EXPLAIN SELECT 1 INTO a.a; END; $$ -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 +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 # # MDEV-14139 Anchored data types for variables # diff --git a/mysql-test/suite/compat/oracle/r/table_value_constr.result b/mysql-test/suite/compat/oracle/r/table_value_constr.result index 812e592ad84..fe9f20e7a2c 100644 --- a/mysql-test/suite/compat/oracle/r/table_value_constr.result +++ b/mysql-test/suite/compat/oracle/r/table_value_constr.result @@ -1294,8 +1294,8 @@ deallocate prepare stmt1; # explain query that uses VALUES structure(s): single VALUES structure explain values (1,2); -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 +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 explain format=json values (1,2); EXPLAIN @@ -1322,26 +1322,26 @@ explain select 1,2 union values (1,2),(3,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 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> NULL ALL 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 explain values (1,2),(3,4) union select 1,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 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 +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 explain values (5,6) union values (1,2),(3,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 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> NULL ALL 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 explain format=json select 1,2 union @@ -1444,11 +1444,11 @@ union values (3,4) union values (1,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 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 +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 explain format=json select 1,2 union @@ -1497,24 +1497,24 @@ explain select 1,2 union values (1,2),(3,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 UNION NULL NULL NULL NULL NULL NULL NULL NULL No tables used -NULL UNION RESULT <union1,2> NULL ALL 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 explain values (1,2),(3,4) union all select 1,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 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 explain values (1,2) union all values (1,2),(3,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 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 explain format=json values (1,2),(3,4) union all @@ -1617,10 +1617,10 @@ union all values (3,4) union all values (1,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 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 +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 explain format=json select 1,2 union all @@ -2114,9 +2114,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 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 +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 NULL 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 @@ -2124,9 +2124,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 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 +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 NULL 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 @@ -2135,11 +2135,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 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 +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 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 select * from (values (7), (5), (8), (1) union select * from t1) t; 7 7 @@ -2150,11 +2150,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 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 +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 NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION t1 NULL ALL NULL NULL NULL NULL 3 100.00 +NULL UNION RESULT <union2,3> NULL ALL NULL NULL NULL NULL NULL NULL drop table t1; # # MDEV-16930: expression in the first row of TVC specifying derived table diff --git a/mysql-test/suite/encryption/r/tempfiles_encrypted.result b/mysql-test/suite/encryption/r/tempfiles_encrypted.result index 261f7383b56..6d70bcc671a 100644 --- a/mysql-test/suite/encryption/r/tempfiles_encrypted.result +++ b/mysql-test/suite/encryption/r/tempfiles_encrypted.result @@ -3136,16 +3136,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 Using temporary +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 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 partitions type possible_keys key key_len ref rows 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 select sum(max(id)) over (order by max(id)) from t1 where id < 3; sum(max(id)) over (order by max(id)) 2 @@ -3468,8 +3468,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 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 +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 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; @@ -3477,8 +3477,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 partitions type possible_keys key key_len ref rows 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 SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP HAVING @A := 'qwerty'; @@ -3487,8 +3487,8 @@ explain SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) HAVING @A := 'qwerty'; -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 +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 SELECT DISTINCT BIT_OR(100) OVER () FROM dual GROUP BY LEFT('2018-08-24', 100) HAVING @A := 'qwerty'; @@ -3497,8 +3497,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Zero limit +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 Zero limit drop table t1; # # MDEV-13170: Database service (MySQL) stops after update with trigger @@ -3541,8 +3541,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using temporary +id select_type 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 SELECT DISTINCT MIN(b1) OVER () FROM t1; MIN(b1) OVER () 1 @@ -3554,9 +3554,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 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 +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 temporary select * from v1; ifnull(max(n1) over (partition by n1),'aaa') 1 @@ -3602,9 +3602,9 @@ explain (SELECT AVG(0) OVER (), MAX('2') FROM t1) UNION ALL (SELECT AVG(0) OVER (), MAX('2') FROM t1); -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 +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 (SELECT AVG(0) OVER (), MAX('2') FROM t1) UNION ALL (SELECT AVG(0) OVER (), MAX('2') FROM t1); @@ -3619,16 +3619,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 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 SELECT b1 from t1 order by row_number() over (ORDER BY b2); b1 0 @@ -3638,8 +3638,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 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 SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); a b c 1 21 909 @@ -3648,8 +3648,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 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 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 @@ -3691,8 +3691,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 Using temporary +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 select max(n1) over (partition by 'abc') from t1; max(n1) over (partition by 'abc') 4 @@ -3701,8 +3701,8 @@ max(n1) over (partition by 'abc') 4 explain select rank() over (partition by 'abc' order by 'xyz') from t1; -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 +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 select rank() over (partition by 'abc' order by 'xyz') from t1; rank() over (partition by 'abc' order by 'xyz') 1 @@ -3739,8 +3739,8 @@ CREATE TABLE t1 (a INT); # explain SELECT row_number() over(), sum(1) FROM t1; -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 +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; Using temporary SELECT row_number() over(), sum(1) FROM t1; row_number() over() sum(1) 1 NULL @@ -3750,8 +3750,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 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 +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 SELECT row_number() over(), sum(1) FROM t1 where a=1; row_number() over() sum(1) 1 NULL @@ -3760,8 +3760,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 partitions type possible_keys key key_len ref rows 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 SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0; row_number() over() sum(1) # @@ -3769,8 +3769,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 Using temporary +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 Using temporary SELECT row_number() over(), sum(a) FROM t1 where a=2; row_number() over() sum(a) 1 2 @@ -3784,8 +3784,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 partitions type possible_keys key key_len ref rows 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 SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; MAX(a) OVER () COUNT(a) abs(a) NULL 0 NULL @@ -3794,8 +3794,8 @@ NULL 0 NULL # EXPLAIN SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE; -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 +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 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/suite/federated/federatedx_create_handlers.result b/mysql-test/suite/federated/federatedx_create_handlers.result index 233aa4d7ecb..5972d31e0c8 100644 --- a/mysql-test/suite/federated/federatedx_create_handlers.result +++ b/mysql-test/suite/federated/federatedx_create_handlers.result @@ -90,8 +90,8 @@ id name 1 zzz EXPLAIN SELECT id FROM federated.t1 WHERE id < 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL EXPLAIN EXTENDED SELECT id FROM federated.t1 WHERE id < 5; id select_type table partitions type possible_keys key key_len ref rows filtered Extra @@ -145,10 +145,10 @@ EXPLAIN SELECT * FROM federated.t3, (SELECT * FROM federated.t1 WHERE id > 3) t WHERE federated.t3.name=t.name; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 7 -1 PRIMARY <derived2> NULL ref key0 key0 18 federated.t3.name 2 -2 PUSHED DERIVED NULL NULL NULL 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 7 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 18 federated.t3.name 2 100.00 +2 PUSHED DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL EXPLAIN FORMAT=JSON SELECT * FROM federated.t3, (SELECT * FROM federated.t1 WHERE id > 3) t @@ -211,10 +211,10 @@ FROM federated.t3, (SELECT t1.name FROM federated.t1 WHERE id IN (SELECT count(*) FROM federated.t2 GROUP BY name)) t WHERE federated.t3.name=t.name; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 7 -1 PRIMARY <derived2> NULL ref key0 key0 18 federated.t3.name 2 -2 PUSHED DERIVED NULL NULL NULL 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 7 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 18 federated.t3.name 2 100.00 +2 PUSHED DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL ANALYZE FORMAT=JSON SELECT * FROM federated.t3, (SELECT t1.name FROM federated.t1 @@ -290,10 +290,10 @@ FROM federated.t3, UNION SELECT * FROM federated.t1 WHERE id >= 5) t WHERE federated.t3.name=t.name; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t3 NULL ALL NULL NULL NULL NULL 7 -1 PRIMARY <derived2> NULL ref key0 key0 18 federated.t3.name 2 -2 PUSHED DERIVED NULL NULL NULL 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 7 100.00 +1 PRIMARY <derived2> NULL ref key0 key0 18 federated.t3.name 2 100.00 +2 PUSHED DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # MDEV-21887: federatedx crashes on SELECT ... INTO query in select_handler code # @@ -320,8 +320,8 @@ select name into outfile 'tmp.txt' from federated.t1; explain select * from federated.t1 where name in (select name from federated.t2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL explain format=json select * from federated.t1 where name in (select name from federated.t2); @@ -345,10 +345,10 @@ explain select * from t5, (select id from federated.t1 where name in (select name from federated.t2) or name like 'foo%') as TQ; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t5 NULL ALL NULL NULL NULL NULL 2 -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -2 PUSHED DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t5 NULL ALL NULL NULL NULL NULL 2 100.00 +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +2 PUSHED DERIVED NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # Must not show elements with select_id=3 explain format=json select * from t5, diff --git a/mysql-test/suite/federated/optimizer.result b/mysql-test/suite/federated/optimizer.result index 2d89ac7a590..5f3c74c2e22 100644 --- a/mysql-test/suite/federated/optimizer.result +++ b/mysql-test/suite/federated/optimizer.result @@ -33,8 +33,8 @@ foo_id parent_foo_id foo_name 822857 NULL STRING explain select foo_id,parent_foo_id,foo_name from fed_t1 where parent_foo_id = 822857 or foo_name like 'STRING%'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE fed_t1 NULL ALL foo_name,parent_foo_id NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE fed_t1 NULL ALL foo_name,parent_foo_id NULL NULL NULL 6 100.00 Using where select foo_id,parent_foo_id,foo_name from fed_t1 where parent_foo_id = 822857 or foo_name like 'STRING%'; foo_id parent_foo_id foo_name 968903 822857 STRING - 0 diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result index e9de8e66c7a..990cf367bd4 100644 --- a/mysql-test/suite/funcs_1/r/innodb_views.result +++ b/mysql-test/suite/funcs_1/r/innodb_views.result @@ -21428,8 +21428,8 @@ SELECT * FROM test3.v32; f1 1.000 EXPLAIN SELECT * FROM test3.v32; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 DROP VIEW test3.v0; SHOW CREATE VIEW test3.v32; View Create View character_set_client collation_connection diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result index dbc48e95177..fe8040a08f7 100644 --- a/mysql-test/suite/funcs_1/r/memory_views.result +++ b/mysql-test/suite/funcs_1/r/memory_views.result @@ -21430,8 +21430,8 @@ SELECT * FROM test3.v32; f1 1.000 EXPLAIN SELECT * FROM test3.v32; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 DROP VIEW test3.v0; SHOW CREATE VIEW test3.v32; View Create View character_set_client collation_connection diff --git a/mysql-test/suite/gcol/inc/gcol_keys.inc b/mysql-test/suite/gcol/inc/gcol_keys.inc index cf0612b0d0c..023e01ae992 100644 --- a/mysql-test/suite/gcol/inc/gcol_keys.inc +++ b/mysql-test/suite/gcol/inc/gcol_keys.inc @@ -203,7 +203,7 @@ INSERT INTO c ( col_time_nokey,col_datetime_nokey,col_varchar_nokey) values ('16:21:18.052408','2001-11-08 21:02:12.009395', 'x'), ('18:56:33.027423','2003-04-01 00:00:00', 'i'); ---replace_column 10 x 11 x +--replace_column 10 x 11 x 12 x EXPLAIN SELECT outr.col_time_key AS x FROM c as outr diff --git a/mysql-test/suite/gcol/inc/gcol_select.inc b/mysql-test/suite/gcol/inc/gcol_select.inc index 784afa3c3d0..79d787d9d5e 100644 --- a/mysql-test/suite/gcol/inc/gcol_select.inc +++ b/mysql-test/suite/gcol/inc/gcol_select.inc @@ -507,7 +507,7 @@ INSERT /*! IGNORE */ INTO cc ( (6, '2008-10-10', NULL, '2000-05-22 00:00:00', 'i'), (8, '2002-01-19', '05:18:40.006865', '2009-02-12 00:00:00', 'v'); ---replace_column 10 # 11 # +--replace_column 10 # 11 # 12 # EXPLAIN SELECT subquery2_t2.col_int_key AS subquery2_field1 FROM (c AS subquery2_t1 RIGHT JOIN @@ -544,10 +544,10 @@ CREATE TABLE cc ( KEY (col_int_key) ); INSERT INTO cc (col_int_nokey) VALUES (0),(1),(7),(0),(4),(5); ---replace_column 10 # 11 # +--replace_column 10 # 11 # 12 # EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3; SELECT pk FROM cc WHERE col_int_key > 3; ---replace_column 10 # 11 # +--replace_column 10 # 11 # 12 # EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; DROP TABLE cc; diff --git a/mysql-test/suite/gcol/r/gcol_bugfixes.result b/mysql-test/suite/gcol/r/gcol_bugfixes.result index 823dab125ae..e7d475c22fe 100644 --- a/mysql-test/suite/gcol/r/gcol_bugfixes.result +++ b/mysql-test/suite/gcol/r/gcol_bugfixes.result @@ -169,8 +169,8 @@ ON ( p1 . gcol_int_key = p2 . pk ) ) AND gp1 . col_varchar_nokey = 'b' HAVING g1 > 6; -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 +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 SELECT gp1 . gcol_datetime_key AS g1 FROM cc AS gp1 LEFT JOIN c AS gp2 ON ( gp2 . gcol_datetime_key <> gp1 . @@ -240,8 +240,8 @@ col_int_nokey <> 9 AND pk >= 8 HAVING x > '2000-02-06' ORDER BY col_time_nokey, pk; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE c NULL index_merge PRIMARY,col_varchar_key,col_varchar_key_2 col_varchar_key,PRIMARY 5,4 NULL 2 Using union(col_varchar_key,PRIMARY); Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE c NULL index_merge PRIMARY,col_varchar_key,col_varchar_key_2 col_varchar_key,PRIMARY 5,4 NULL 2 100.00 Using union(col_varchar_key,PRIMARY); Using where SELECT COUNT(DISTINCT col_varchar_key) AS x FROM c WHERE col_varchar_key IN ('rr', 'rr') OR @@ -333,8 +333,8 @@ test.t1 analyze status OK # Make sure the index is correct. That's kinda important. EXPLAIN SELECT c FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 5 100.00 Using index SELECT c FROM t1; c 1 @@ -371,16 +371,16 @@ b CHAR(2) GENERATED ALWAYS AS (a IN (1)) VIRTUAL, KEY(c,b(1))); INSERT INTO v (a,c) VALUES (1,1); EXPLAIN SELECT 1 FROM t WHERE ( SELECT 1 FROM t ) >=ANY( SELECT c FROM v ); -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 Select tables optimized away -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 +3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL no matching row in const table SELECT 1 FROM t WHERE ( SELECT 1 FROM t ) >=ANY( SELECT c FROM v ); 1 EXPLAIN SELECT (SELECT MAX(c) FROM v); -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 Select tables optimized away +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 Select tables optimized away SELECT (SELECT MAX(c) FROM v); (SELECT MAX(c) FROM v) 1 @@ -637,11 +637,11 @@ ucrgafld VARCHAR(30) COLLATE UTF8_BIN NOT NULL DEFAULT SUBSTRING_INDEX(USER(),'@',1) ); EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE gafld NULL ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gafld NULL ALL NULL NULL NULL NULL 1 100.00 Using where EXPLAIN UPDATE gafld SET nuigafld = 0 WHERE nuigafld = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE gafld NULL ALL NULL NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE gafld NULL ALL NULL NULL NULL NULL 1 100.00 Using where DROP TABLE gafld; # (duplicate) MDEV-17653 replace into generated columns is unstable # Some columns are snipped from the MDEV test diff --git a/mysql-test/suite/gcol/r/gcol_ins_upd_innodb.result b/mysql-test/suite/gcol/r/gcol_ins_upd_innodb.result index d5cc886c952..a3436796918 100644 --- a/mysql-test/suite/gcol/r/gcol_ins_upd_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_ins_upd_innodb.result @@ -494,10 +494,10 @@ INNR1.col_varchar_key AS y FROM bb AS INNR1 WHERE OUTR1.pk = 1 ); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY OUTR1 NULL const PRIMARY PRIMARY 4 const 1 -1 PRIMARY INNR1 NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR1) -1 PRIMARY OUTR2 NULL index NULL PRIMARY 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY OUTR1 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 PRIMARY INNR1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(OUTR1) +1 PRIMARY OUTR2 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index DROP TABLE IF EXISTS b,bb,d; # # Bug#21216067 ASSERTION FAILED ROW_UPD_SEC_INDEX_ENTRY (INNOBASE/ROW/ROW0UPD.CC:2103) @@ -536,9 +536,9 @@ INSERT INTO C (col_varchar_nokey) VALUES ('c'); EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE OUTR1 NULL ALL NULL NULL NULL NULL 1 -1 SIMPLE OUTR2 NULL ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE OUTR1 NULL ALL NULL NULL NULL NULL 1 100.00 +1 SIMPLE OUTR2 NULL ALL NULL NULL NULL NULL 1 100.00 UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; @@ -557,9 +557,9 @@ INSERT INTO C (col_varchar_nokey) VALUES ('c'); EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE OUTR1 NULL ALL NULL NULL NULL NULL 1 -1 SIMPLE OUTR2 NULL ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE OUTR1 NULL ALL NULL NULL NULL NULL 1 100.00 +1 SIMPLE OUTR2 NULL ALL NULL NULL NULL NULL 1 100.00 UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; @@ -577,9 +577,9 @@ INSERT INTO C (col_varchar_nokey) VALUES ('c'); EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE OUTR1 NULL ALL NULL NULL NULL NULL 1 -1 SIMPLE OUTR2 NULL ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE OUTR1 NULL ALL NULL NULL NULL NULL 1 100.00 +1 SIMPLE OUTR2 NULL ALL NULL NULL NULL NULL 1 100.00 UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; @@ -598,9 +598,9 @@ INSERT INTO C (col_varchar_nokey) VALUES ('c'); EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE OUTR1 NULL ALL NULL NULL NULL NULL 1 -1 SIMPLE OUTR2 NULL ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE OUTR1 NULL ALL NULL NULL NULL NULL 1 100.00 +1 SIMPLE OUTR2 NULL ALL NULL NULL NULL NULL 1 100.00 UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; diff --git a/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result b/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result index 75aba0fc35a..c0cd3cad5fa 100644 --- a/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_ins_upd_myisam.result @@ -416,10 +416,10 @@ INNR1.col_varchar_key AS y FROM bb AS INNR1 WHERE OUTR1.pk = 1 ); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY OUTR1 NULL const PRIMARY PRIMARY 4 const 1 -1 PRIMARY INNR1 NULL ALL NULL NULL NULL NULL 2 Using where; FirstMatch(OUTR1) -1 PRIMARY OUTR2 NULL index NULL PRIMARY 4 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY OUTR1 NULL const PRIMARY PRIMARY 4 const 1 100.00 +1 PRIMARY INNR1 NULL ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(OUTR1) +1 PRIMARY OUTR2 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index DROP TABLE IF EXISTS b,bb,d; # # Bug#21216067 ASSERTION FAILED ROW_UPD_SEC_INDEX_ENTRY (INNOBASE/ROW/ROW0UPD.CC:2103) @@ -458,9 +458,9 @@ INSERT INTO C (col_varchar_nokey) VALUES ('c'); EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE OUTR1 NULL system NULL NULL NULL NULL 1 -1 SIMPLE OUTR2 NULL system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE OUTR1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE OUTR2 NULL system NULL NULL NULL NULL 1 100.00 UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; @@ -479,9 +479,9 @@ INSERT INTO C (col_varchar_nokey) VALUES ('c'); EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE OUTR1 NULL system NULL NULL NULL NULL 1 -1 SIMPLE OUTR2 NULL system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE OUTR1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE OUTR2 NULL system NULL NULL NULL NULL 1 100.00 UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; @@ -499,9 +499,9 @@ INSERT INTO C (col_varchar_nokey) VALUES ('c'); EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE OUTR1 NULL system NULL NULL NULL NULL 1 -1 SIMPLE OUTR2 NULL system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE OUTR1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE OUTR2 NULL system NULL NULL NULL NULL 1 100.00 UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; @@ -520,9 +520,9 @@ INSERT INTO C (col_varchar_nokey) VALUES ('c'); EXPLAIN UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE OUTR1 NULL system NULL NULL NULL NULL 1 -1 SIMPLE OUTR2 NULL system NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE OUTR1 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE OUTR2 NULL system NULL NULL NULL NULL 1 100.00 UPDATE C AS OUTR1, C AS OUTR2 SET OUTR1.`col_varchar_nokey` = 'f', OUTR2.`col_varchar_nokey` = "a"; diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result index ac808f66c21..5e7f612128a 100644 --- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result @@ -204,8 +204,8 @@ WHERE outr.col_varchar_nokey in ('c', 'x', 'i') AND (outr.col_time_key IS NULL OR outr.col_datetime_key = '2009-09-27'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE outr NULL index_merge col_time_key,col_datetime_key col_time_key,col_datetime_key 4,6 NULL x x +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE outr NULL index_merge col_time_key,col_datetime_key col_time_key,col_datetime_key 4,6 NULL x x x SELECT outr.col_time_key AS x FROM c AS outr @@ -312,8 +312,8 @@ UNIQUE KEY (b) ); INSERT INTO t1 (id) VALUES (2),(3),(4),(5),(6),(7),(8),(9),(10); EXPLAIN SELECT b FROM t1 FORCE INDEX(b); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 5 NULL 9 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 9 100.00 Using index SELECT b FROM t1 FORCE INDEX(b); b 3 @@ -326,8 +326,8 @@ b 10 11 EXPLAIN SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range b b 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 5 NULL 3 100.00 Using where; Using index SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; b 3 @@ -357,29 +357,29 @@ f1 gc 8 9 9 10 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7; -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 +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 SELECT * FROM t1 WHERE f1 + 1 = 7; f1 gc 6 7 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 = 7; -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 +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 SELECT * FROM t1 WHERE f1 + 1 IN (7,5); f1 gc 4 5 6 7 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 IN(7,5); -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 +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 SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; f1 gc 4 5 5 6 6 7 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; -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 +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 # Check that expression isn't transformed for a disabled key SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; f1 gc @@ -387,8 +387,8 @@ f1 gc 5 6 6 7 EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; -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 +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 # Check that ORDER BY could be optimized SELECT * FROM t1 ORDER BY f1 + 1; f1 gc @@ -403,11 +403,11 @@ f1 gc 8 9 9 10 EXPLAIN SELECT * FROM t1 ORDER BY f1 + 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 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 EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) ORDER BY f1 + 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 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 # Check that GROUP BY could be optimized SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 1; f1 + 1 MAX(GC) @@ -422,12 +422,12 @@ f1 + 1 MAX(GC) 9 9 10 10 EXPLAIN SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 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 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 10 100.00 Using temporary; Using filesort EXPLAIN SELECT f1 + 1, MAX(GC) FROM t1 IGNORE KEY (gc) GROUP BY f1 + 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 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 10 100.00 Using temporary; Using filesort # Shouldn't use index SELECT * FROM t1 WHERE f1 + 1 > 7.0; f1 gc @@ -435,8 +435,8 @@ f1 gc 8 9 9 10 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7.0; -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 +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 DROP TABLE t1; # Pick index with proper type CREATE TABLE t1 (f1 int, @@ -466,8 +466,8 @@ f1 gc_int gc_date 90909 90910 2009-09-10 # INT column & index should be picked EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 070707; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); f1 gc_int gc_date 101010 101011 2010-10-11 @@ -476,8 +476,8 @@ f1 gc_int gc_date 90909 90910 2009-09-10 # DATE column & index should be picked EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where DROP TABLE t1; # # BUG#21229846: WL8170: SIGNAL 11 IN JOIN::MAKE_SUM_FUNC_LIST @@ -501,9 +501,9 @@ field1 field2 EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) ORDER BY field1, field2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE table1 NULL ALL PRIMARY NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE table2 NULL eq_ref PRIMARY PRIMARY 4 test.table1.pk 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE table1 NULL ALL PRIMARY NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 SIMPLE table2 NULL eq_ref PRIMARY PRIMARY 4 test.table1.pk 1 100.00 SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) GROUP BY field1, field2; @@ -512,9 +512,9 @@ field1 field2 EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) GROUP BY field1, field2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE table1 NULL ALL PRIMARY NULL NULL NULL 1 Using temporary; Using filesort -1 SIMPLE table2 NULL eq_ref PRIMARY PRIMARY 4 test.table1.pk 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE table1 NULL ALL PRIMARY NULL NULL NULL 1 100.00 Using temporary; Using filesort +1 SIMPLE table2 NULL eq_ref PRIMARY PRIMARY 4 test.table1.pk 1 100.00 DROP TABLE t1; # # Bug#21391781 ASSERT WHEN RUNNING ALTER TABLE ON A TABLE WITH INDEX @@ -733,69 +733,69 @@ Table Op Msg_type Msg_text test.t analyze status Engine-independent statistics collected test.t analyze status OK EXPLAIN SELECT a, b FROM t WHERE (a AND b) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a AND b) = 1; a b 1 1 EXPLAIN SELECT a, b FROM t WHERE 1 = (a AND b); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE 1 = (a AND b); a b 1 1 EXPLAIN SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); a b 1 1 EXPLAIN SELECT a, b FROM t WHERE (a OR b) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a OR b) = 1; a b 0 1 1 0 1 1 EXPLAIN SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; a b 0 1 1 0 1 1 EXPLAIN SELECT a, b FROM t WHERE (a XOR b) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a XOR b) = 1; a b 0 1 1 0 EXPLAIN SELECT a FROM t WHERE (NOT a) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a FROM t WHERE (NOT a) = 1; a 0 0 EXPLAIN SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; a 0 1 EXPLAIN SELECT a, b FROM t WHERE 1 = (b AND a); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE 1 = (b AND a); a b 1 1 EXPLAIN SELECT a, b FROM t WHERE 1 = (b OR a); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE 1 = (b OR a); a b 0 1 @@ -819,15 +819,15 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK # Used to choose the index on a1 and get wrong results. EXPLAIN SELECT * FROM t1 WHERE (a2 AND a2) = 0; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 Using where SELECT * FROM t1 WHERE (a2 AND a2) = 0; a1 a2 # Used to get assertion or wrong results. EXPLAIN SELECT * FROM t1 STRAIGHT_JOIN t2 ON b WHERE (b AND 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 1 -1 SIMPLE t2 NULL 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 filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 1 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 Using where; Using join buffer (flat, BNL join) SELECT * FROM t1 STRAIGHT_JOIN t2 ON b WHERE (b AND b) = 1; a1 a2 b 0 NULL 1 diff --git a/mysql-test/suite/gcol/r/gcol_keys_myisam.result b/mysql-test/suite/gcol/r/gcol_keys_myisam.result index 75d8afbd15c..1e315e82c44 100644 --- a/mysql-test/suite/gcol/r/gcol_keys_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_keys_myisam.result @@ -204,8 +204,8 @@ WHERE outr.col_varchar_nokey in ('c', 'x', 'i') AND (outr.col_time_key IS NULL OR outr.col_datetime_key = '2009-09-27'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE outr NULL index_merge col_time_key,col_datetime_key col_time_key,col_datetime_key 4,6 NULL x x +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE outr NULL index_merge col_time_key,col_datetime_key col_time_key,col_datetime_key 4,6 NULL x x x SELECT outr.col_time_key AS x FROM c AS outr @@ -312,8 +312,8 @@ UNIQUE KEY (b) ); INSERT INTO t1 (id) VALUES (2),(3),(4),(5),(6),(7),(8),(9),(10); EXPLAIN SELECT b FROM t1 FORCE INDEX(b); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 5 NULL 9 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 9 100.00 Using index SELECT b FROM t1 FORCE INDEX(b); b 3 @@ -326,8 +326,8 @@ b 10 11 EXPLAIN SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range b b 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 5 NULL 3 100.00 Using where; Using index SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; b 3 @@ -357,29 +357,29 @@ f1 gc 8 9 9 10 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7; -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 +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 SELECT * FROM t1 WHERE f1 + 1 = 7; f1 gc 6 7 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 = 7; -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 +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 SELECT * FROM t1 WHERE f1 + 1 IN (7,5); f1 gc 4 5 6 7 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 IN(7,5); -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 +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 SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; f1 gc 4 5 5 6 6 7 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 BETWEEN 5 AND 7; -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 +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 # Check that expression isn't transformed for a disabled key SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; f1 gc @@ -387,8 +387,8 @@ f1 gc 5 6 6 7 EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) WHERE f1 + 1 BETWEEN 5 AND 7; -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 +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 # Check that ORDER BY could be optimized SELECT * FROM t1 ORDER BY f1 + 1; f1 gc @@ -403,11 +403,11 @@ f1 gc 8 9 9 10 EXPLAIN SELECT * FROM t1 ORDER BY f1 + 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 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 EXPLAIN SELECT * FROM t1 IGNORE KEY (gc) ORDER BY f1 + 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 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 # Check that GROUP BY could be optimized SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 1; f1 + 1 MAX(GC) @@ -422,12 +422,12 @@ f1 + 1 MAX(GC) 9 9 10 10 EXPLAIN SELECT f1 + 1, MAX(GC) FROM t1 GROUP BY f1 + 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 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 10 100.00 Using temporary; Using filesort EXPLAIN SELECT f1 + 1, MAX(GC) FROM t1 IGNORE KEY (gc) GROUP BY f1 + 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 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 10 100.00 Using temporary; Using filesort # Shouldn't use index SELECT * FROM t1 WHERE f1 + 1 > 7.0; f1 gc @@ -435,8 +435,8 @@ f1 gc 8 9 9 10 EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 7.0; -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 +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 DROP TABLE t1; # Pick index with proper type CREATE TABLE t1 (f1 int, @@ -466,8 +466,8 @@ f1 gc_int gc_date 90909 90910 2009-09-10 # INT column & index should be picked EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > 070707; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); f1 gc_int gc_date 101010 101011 2010-10-11 @@ -476,8 +476,8 @@ f1 gc_int gc_date 90909 90910 2009-09-10 # DATE column & index should be picked EXPLAIN SELECT * FROM t1 WHERE f1 + 1 > CAST(070707 AS DATE); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 18 100.00 Using where DROP TABLE t1; # # BUG#21229846: WL8170: SIGNAL 11 IN JOIN::MAKE_SUM_FUNC_LIST @@ -501,9 +501,9 @@ field1 field2 EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) ORDER BY field1, field2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE table1 NULL system PRIMARY NULL NULL NULL 1 -1 SIMPLE table2 NULL system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE table1 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE table2 NULL system PRIMARY NULL NULL NULL 1 100.00 SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) GROUP BY field1, field2; @@ -512,9 +512,9 @@ field1 field2 EXPLAIN SELECT table1.col_int_key + 1 AS field1, table2.col_int_key AS field2 FROM (t1 AS table1 JOIN t1 AS table2 ON (table2.pk = table1.pk)) GROUP BY field1, field2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE table1 NULL system PRIMARY NULL NULL NULL 1 -1 SIMPLE table2 NULL system PRIMARY NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE table1 NULL system PRIMARY NULL NULL NULL 1 100.00 +1 SIMPLE table2 NULL system PRIMARY NULL NULL NULL 1 100.00 DROP TABLE t1; # # Bug#21391781 ASSERT WHEN RUNNING ALTER TABLE ON A TABLE WITH INDEX @@ -733,69 +733,69 @@ Table Op Msg_type Msg_text test.t analyze status Engine-independent statistics collected test.t analyze status OK EXPLAIN SELECT a, b FROM t WHERE (a AND b) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a AND b) = 1; a b 1 1 EXPLAIN SELECT a, b FROM t WHERE 1 = (a AND b); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE 1 = (a AND b); a b 1 1 EXPLAIN SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a AND b) IN (1, 2, 3); a b 1 1 EXPLAIN SELECT a, b FROM t WHERE (a OR b) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a OR b) = 1; a b 0 1 1 0 1 1 EXPLAIN SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a OR b) BETWEEN 1 AND 10; a b 0 1 1 0 1 1 EXPLAIN SELECT a, b FROM t WHERE (a XOR b) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE (a XOR b) = 1; a b 0 1 1 0 EXPLAIN SELECT a FROM t WHERE (NOT a) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a FROM t WHERE (NOT a) = 1; a 0 0 EXPLAIN SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a FROM t WHERE (CASE WHEN (a AND b) THEN a ELSE b END) = 1; a 0 1 EXPLAIN SELECT a, b FROM t WHERE 1 = (b AND a); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE 1 = (b AND a); a b 1 1 EXPLAIN SELECT a, b FROM t WHERE 1 = (b OR a); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t NULL ALL NULL NULL NULL NULL 4 100.00 Using where SELECT a, b FROM t WHERE 1 = (b OR a); a b 0 1 @@ -819,15 +819,15 @@ test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK # Used to choose the index on a1 and get wrong results. EXPLAIN SELECT * FROM t1 WHERE (a2 AND a2) = 0; -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 +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 SELECT * FROM t1 WHERE (a2 AND a2) = 0; a1 a2 # Used to get assertion or wrong results. EXPLAIN SELECT * FROM t1 STRAIGHT_JOIN t2 ON b WHERE (b AND b) = 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 -1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 +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 SELECT * FROM t1 STRAIGHT_JOIN t2 ON b WHERE (b AND b) = 1; a1 a2 b 0 NULL 1 diff --git a/mysql-test/suite/gcol/r/gcol_select_innodb.result b/mysql-test/suite/gcol/r/gcol_select_innodb.result index 0f12312fb6f..4b9800fd8d6 100644 --- a/mysql-test/suite/gcol/r/gcol_select_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_select_innodb.result @@ -31,45 +31,45 @@ select * from t2; a b c 1 -1 -1 explain select * from t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 select * from t2 where c=-1; a b c 1 -1 -1 explain select * from t2 where c=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref c c 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c c 5 const 1 100.00 # select_type=SIMPLE, type=ALL select * from t1 where b=-1; a b c 1 -1 -1 1 -1 -1 explain select * from t1 where 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 5 Using where +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 # select_type=SIMPLE, type=const select * from t3 where a=1; a b c 1 -1 -1 explain select * from t3 where a=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 # select_type=SIMPLE, type=range select * from t3 where c>=-1; a b c 1 -1 -1 explain select * from t3 where c>=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 1 100.00 Using index condition # select_type=SIMPLE, type=ref select * from t1,t3 where t1.c=t3.c and t3.c=-1; a b c a b c 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 explain select * from t1,t3 where t1.c=t3.c and t3.c=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL const c c 5 const 1 -1 SIMPLE t1 NULL ref c c 5 const 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const c c 5 const 1 100.00 +1 SIMPLE t1 NULL ref c c 5 const 2 100.00 # select_type=PRIMARY, type=index,ALL select * from t1 where b in (select c from t3); a b c @@ -78,9 +78,9 @@ a b c 2 -2 -2 3 -3 -3 explain select * from t1 where b in (select c from t3); -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 t3 NULL eq_ref c c 5 test.t1.b 1 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 5 100.00 Using where +1 PRIMARY t3 NULL eq_ref c c 5 test.t1.b 1 100.00 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c @@ -88,9 +88,9 @@ a b c 1 -1 -1 2 -2 -2 explain select * from t1 where c in (select c from t3 where c between -2 and -1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t3 NULL range c c 5 NULL 2 Using where; Using index -1 PRIMARY t1 NULL ref c c 5 test.t3.c 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL range c c 5 NULL 2 100.00 Using where; Using index +1 PRIMARY t1 NULL ref c c 5 test.t3.c 1 100.00 # select_type=UNION, type=system # select_type=UNION RESULT, type=<union1,2> select * from t1 union select * from t2; @@ -100,10 +100,10 @@ a b c 3 -3 -3 NULL NULL NULL explain select * from t1 union select * from t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 -2 UNION t2 NULL ALL NULL NULL NULL NULL 1 -NULL UNION RESULT <union1,2> NULL ALL 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 1 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL # select_type=DERIVED, type=system select * from (select a,b,c from t1) as t11; a b c @@ -113,9 +113,9 @@ a b c 3 -3 -3 NULL NULL NULL explain select * from (select a,b,c from t1) as t11; -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 t1 NULL ALL NULL NULL NULL NULL 5 +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 ### ### Using aggregate functions with/without DISTINCT ### @@ -124,29 +124,29 @@ select count(*) from t1; count(*) 5 explain select count(*) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 5 100.00 Using index # SELECT COUNT(DISTINCT <non-gcol>) FROM tbl_name select count(distinct a) from t1; count(distinct a) 3 explain select count(distinct a) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 # SELECT COUNT(DISTINCT <non-stored gcol>) FROM tbl_name select count(distinct b) from t1; count(distinct b) 3 explain select count(distinct b) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 # SELECT COUNT(DISTINCT <stored gcol>) FROM tbl_name select count(distinct c) from t1; count(distinct c) 3 explain select count(distinct c) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range NULL c 5 NULL 6 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 c 5 NULL 6 100.00 Using index for group-by ### ### filesort & range-based utils ### @@ -156,40 +156,40 @@ a b c 1 -1 -1 2 -2 -2 explain select * from t3 where c >= -2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT * FROM tbl_name WHERE <non-gcol expr> select * from t3 where a between 1 and 2; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where a between 1 and 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> select * from t3 where b between -2 and -1; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where b between -2 and -1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 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 6 33.33 Using where # SELECT * FROM tbl_name WHERE <indexed gcol expr> select * from t3 where c between -2 and -1; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where c between -2 and -1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT * FROM tbl_name WHERE <non-gcol expr> ORDER BY <non-indexed gcol> select * from t3 where a between 1 and 2 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where a between 1 and 2 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using filesort # bug#20022189: WL411:DEBUG ASSERT AT FIELD_LONG::VAL_INT IN SQL/FIELD.CC # SELECT * FROM tbl_name WHERE <non-gcol expr> ORDER BY <non-indexed stored gcol> select * from t3 where a between 1 and 2 order by c; @@ -197,8 +197,8 @@ a b c 2 -2 -2 1 -1 -1 explain select * from t3 where a between 1 and 2 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using filesort # bug#20022189: WL411:DEBUG ASSERT AT FIELD_LONG::VAL_INT IN SQL/FIELD.CC CREATE TABLE t4 ( `pk` int(11) NOT NULL , @@ -227,48 +227,48 @@ a b c 2 -2 -2 1 -1 -1 explain select * from t3 where a between 1 and 2 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <non-gcol> select * from t3 where b between -2 and -1 order by a; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where b between -2 and -1 order by a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL index NULL PRIMARY 4 NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index NULL PRIMARY 4 NULL 6 33.33 Using where # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <non-indexed gcol> select * from t3 where b between -2 and -1 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where b between -2 and -1 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 33.33 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <non-indexed gcol> select * from t3 where c between -2 and -1 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <indexed gcol> select * from t3 where b between -2 and -1 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where b between -2 and -1 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 33.33 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <indexed gcol> select * from t3 where c between -2 and -1 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT sum(<non-indexed gcol>) FROM tbl_name GROUP BY <non-indexed gcol> select sum(b) from t1 group by b; sum(b) @@ -277,8 +277,8 @@ NULL -2 -2 explain select sum(b) from t1 group by b; -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 +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 temporary; Using filesort # SELECT sum(<indexed gcol>) FROM tbl_name GROUP BY <indexed gcol> select sum(c) from t1 group by c; sum(c) @@ -287,8 +287,8 @@ NULL -2 -2 explain select sum(c) from t1 group by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 5 100.00 Using index # SELECT sum(<non-indexed gcol>) FROM tbl_name GROUP BY <indexed gcol> select sum(b) from t1 group by c; sum(b) @@ -297,8 +297,8 @@ NULL -2 -2 explain select sum(b) from t1 group by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 5 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 5 100.00 # SELECT sum(<indexed gcol>) FROM tbl_name GROUP BY <non-indexed gcol> select sum(c) from t1 group by b; sum(c) @@ -307,8 +307,8 @@ NULL -2 -2 explain select sum(c) from t1 group by b; -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 +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 temporary; Using filesort drop table t1; # # Bug#20241655: WL411:FAILING ASSERTION ASSERTION @@ -556,9 +556,9 @@ UNIQUE KEY i0008 (a) INSERT INTO t(a,b) VALUES(1,'cccc'); EXPLAIN SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c WHERE b.b>c.a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE b NULL ALL i0008 NULL NULL NULL 1 -1 SIMPLE c NULL ALL i0008 NULL NULL NULL 1 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 b NULL ALL i0008 NULL NULL NULL 1 100.00 +1 SIMPLE c NULL ALL i0008 NULL NULL NULL 1 100.00 Range checked for each record (index map: 0x1) SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c WHERE b.b>c.a; c @@ -589,8 +589,8 @@ a0.i1 + a1.i1*10 FROM t0 AS a0, t0 AS a1, t0 AS a2; EXPLAIN SELECT * FROM t1 WHERE i1 > 41 AND i1 <= 43; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 4 NULL 20 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 4 NULL 20 100.00 Using index condition SELECT * FROM t1 WHERE i1 > 41 AND i1 <= 43; pk i1 i2 v1 v2 @@ -616,8 +616,8 @@ pk i1 i2 v1 v2 943 43 43 44 1 EXPLAIN SELECT * FROM t1 WHERE v1 > 41 AND v1 <= 43; -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 +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.00 Using where SELECT * FROM t1 WHERE v1 > 41 AND v1 <= 43; pk i1 i2 v1 v2 @@ -698,12 +698,12 @@ WHERE t4.c1 < 'o' ) ) AND t1.i1 <= t3.i2_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 -1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 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 ALL distinct_key NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN @@ -753,12 +753,12 @@ WHERE t4.c1 < 'o' ) ) AND t1.i1 <= t3.i2_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 -1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 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 ALL distinct_key NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN @@ -809,12 +809,12 @@ WHERE t4.c1 < 'o' ) ) AND t1.i1 <= t3.i2_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 -1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 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 ALL distinct_key NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN @@ -873,12 +873,12 @@ WHERE t4.c1 < 'o' ) ) AND t1.i1 <= t3.i2_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 -1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 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 ALL distinct_key NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN @@ -929,11 +929,11 @@ WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1) ) ) AND t1.i1 <= t3.i2_key; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 Using where; Start temporary -1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) -1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL 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 filtered Extra +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL eq_ref PRIMARY PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; End temporary; Using join buffer (flat, BNL join) SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN diff --git a/mysql-test/suite/gcol/r/gcol_select_myisam.result b/mysql-test/suite/gcol/r/gcol_select_myisam.result index 8cd4c57eaf9..32e68635a9a 100644 --- a/mysql-test/suite/gcol/r/gcol_select_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_select_myisam.result @@ -31,45 +31,45 @@ select * from t2; a b c 1 -1 -1 explain select * from t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 +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 select * from t2 where c=-1; a b c 1 -1 -1 explain select * from t2 where c=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL system c NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system c NULL NULL NULL 1 100.00 # select_type=SIMPLE, type=ALL select * from t1 where b=-1; a b c 1 -1 -1 1 -1 -1 explain select * from t1 where 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 5 Using where +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 # select_type=SIMPLE, type=const select * from t3 where a=1; a b c 1 -1 -1 explain select * from t3 where a=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 # select_type=SIMPLE, type=range select * from t3 where c>=-1; a b c 1 -1 -1 explain select * from t3 where c>=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 1 100.00 Using index condition # select_type=SIMPLE, type=ref select * from t1,t3 where t1.c=t3.c and t3.c=-1; a b c a b c 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 explain select * from t1,t3 where t1.c=t3.c and t3.c=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL const c c 5 const 1 -1 SIMPLE t1 NULL ref c c 5 const 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const c c 5 const 1 100.00 +1 SIMPLE t1 NULL ref c c 5 const 2 100.00 # select_type=PRIMARY, type=index,ALL select * from t1 where b in (select c from t3); a b c @@ -78,9 +78,9 @@ a b c 2 -2 -2 3 -3 -3 explain select * from t1 where b in (select c from t3); -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 t3 NULL eq_ref c c 5 test.t1.b 1 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 5 100.00 Using where +1 PRIMARY t3 NULL eq_ref c c 5 test.t1.b 1 100.00 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c @@ -88,9 +88,9 @@ a b c 1 -1 -1 2 -2 -2 explain select * from t1 where c in (select c from t3 where c between -2 and -1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t3 NULL range c c 5 NULL 2 Using where; Using index -1 PRIMARY t1 NULL ref c c 5 test.t3.c 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL range c c 5 NULL 2 100.00 Using where; Using index +1 PRIMARY t1 NULL ref c c 5 test.t3.c 1 100.00 # select_type=UNION, type=system # select_type=UNION RESULT, type=<union1,2> select * from t1 union select * from t2; @@ -100,10 +100,10 @@ a b c 3 -3 -3 NULL NULL NULL explain select * from t1 union select * from t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 -2 UNION t2 NULL system NULL NULL NULL NULL 1 -NULL UNION RESULT <union1,2> NULL ALL 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 system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL # select_type=DERIVED, type=system select * from (select a,b,c from t1) as t11; a b c @@ -113,9 +113,9 @@ a b c 3 -3 -3 NULL NULL NULL explain select * from (select a,b,c from t1) as t11; -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 t1 NULL ALL NULL NULL NULL NULL 5 +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 ### ### Using aggregate functions with/without DISTINCT ### @@ -124,29 +124,29 @@ select count(*) from t1; count(*) 5 explain select count(*) from t1; -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 +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 # SELECT COUNT(DISTINCT <non-gcol>) FROM tbl_name select count(distinct a) from t1; count(distinct a) 3 explain select count(distinct a) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 # SELECT COUNT(DISTINCT <non-stored gcol>) FROM tbl_name select count(distinct b) from t1; count(distinct b) 3 explain select count(distinct b) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 # SELECT COUNT(DISTINCT <stored gcol>) FROM tbl_name select count(distinct c) from t1; count(distinct c) 3 explain select count(distinct c) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range NULL c 5 NULL 6 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 c 5 NULL 6 100.00 Using index for group-by ### ### filesort & range-based utils ### @@ -156,32 +156,32 @@ a b c 1 -1 -1 2 -2 -2 explain select * from t3 where c >= -2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT * FROM tbl_name WHERE <non-gcol expr> select * from t3 where a between 1 and 2; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where a between 1 and 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> select * from t3 where b between -2 and -1; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where b between -2 and -1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 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 6 33.33 Using where # SELECT * FROM tbl_name WHERE <indexed gcol expr> select * from t3 where c between -2 and -1; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where c between -2 and -1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # bug#20022189: WL411:DEBUG ASSERT AT FIELD_LONG::VAL_INT IN SQL/FIELD.CC CREATE TABLE t4 ( `pk` int(11) NOT NULL , @@ -210,56 +210,56 @@ a b c 2 -2 -2 1 -1 -1 explain select * from t3 where a between 1 and 2 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <non-gcol> select * from t3 where b between -2 and -1 order by a; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where b between -2 and -1 order by a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 33.33 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <non-gcol> select * from t3 where c between -2 and -1 order by a; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where c between -2 and -1 order by a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <non-indexed gcol> select * from t3 where b between -2 and -1 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where b between -2 and -1 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 33.33 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <non-indexed gcol> select * from t3 where c between -2 and -1 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <indexed gcol> select * from t3 where b between -2 and -1 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where b between -2 and -1 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 33.33 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <indexed gcol> select * from t3 where c between -2 and -1 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT sum(<non-indexed gcol>) FROM tbl_name GROUP BY <non-indexed gcol> select sum(b) from t1 group by b; sum(b) @@ -268,8 +268,8 @@ NULL -2 -2 explain select sum(b) from t1 group by b; -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 +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 temporary; Using filesort # SELECT sum(<indexed gcol>) FROM tbl_name GROUP BY <indexed gcol> select sum(c) from t1 group by c; sum(c) @@ -278,8 +278,8 @@ NULL -2 -2 explain select sum(c) from t1 group by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 5 100.00 Using index # SELECT sum(<non-indexed gcol>) FROM tbl_name GROUP BY <indexed gcol> select sum(b) from t1 group by c; sum(b) @@ -288,8 +288,8 @@ NULL -2 -2 explain select sum(b) from t1 group by c; -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 +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 temporary; Using filesort # SELECT sum(<indexed gcol>) FROM tbl_name GROUP BY <non-indexed gcol> select sum(c) from t1 group by b; sum(c) @@ -298,8 +298,8 @@ NULL -2 -2 explain select sum(c) from t1 group by b; -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 +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 temporary; Using filesort drop table t1; # # Bug#20241655: WL411:FAILING ASSERTION ASSERTION @@ -590,10 +590,10 @@ FROM (c AS subquery2_t1 RIGHT JOIN (subquery2_t3.col_int_nokey = subquery2_t2.col_int_key )) ON (subquery2_t3.col_varchar_key = subquery2_t2.col_varchar_key)) ORDER BY subquery2_field1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE subquery2_t2 NULL index NULL col_int_key_2 10 NULL # # -1 SIMPLE subquery2_t3 NULL ALL NULL NULL NULL NULL # # -1 SIMPLE subquery2_t1 NULL index NULL PRIMARY 4 NULL # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE subquery2_t2 NULL index NULL col_int_key_2 10 NULL # # # +1 SIMPLE subquery2_t3 NULL ALL NULL NULL NULL NULL # # # +1 SIMPLE subquery2_t1 NULL index NULL PRIMARY 4 NULL # # # SELECT subquery2_t2.col_int_key AS subquery2_field1 FROM (c AS subquery2_t1 RIGHT JOIN (c AS subquery2_t2 LEFT JOIN cc AS subquery2_t3 ON @@ -793,16 +793,16 @@ KEY (col_int_key) ); INSERT INTO cc (col_int_nokey) VALUES (0),(1),(7),(0),(4),(5); EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE cc NULL range col_int_key col_int_key 5 NULL # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE cc NULL range col_int_key col_int_key 5 NULL # # # SELECT pk FROM cc WHERE col_int_key > 3; pk 5 6 3 EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE cc NULL range col_int_key col_int_key 5 NULL # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE cc NULL range col_int_key col_int_key 5 NULL # # # SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; pk 3 @@ -875,13 +875,13 @@ WHERE SUBQUERY1_t2.pk >= 9 ) AS table3 ON (table3.col_int_key = table2.col_int_key ) ) ) ON (table3.col_int_nokey = table2.pk ) ) GROUP BY field1, field2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY table1 NULL system NULL NULL NULL NULL # -1 PRIMARY table2 NULL ALL PRIMARY,col_int_key,col_int_key_2 NULL NULL NULL # Using where -1 PRIMARY <derived2> NULL ref key0 key0 9 test.table2.pk,test.table2.col_int_key # -2 DERIVED SUBQUERY1_t2 NULL ALL PRIMARY,col_int_key,col_varchar_key,col_int_key_2 NULL NULL NULL # Using where -2 DERIVED SUBQUERY1_t3 NULL ref PRIMARY,col_varchar_key col_varchar_key 5 test.SUBQUERY1_t2.col_varchar_key # -2 DERIVED SUBQUERY1_t1 NULL ALL col_int_key,col_int_key_2 NULL NULL NULL # 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 table1 NULL system NULL NULL NULL NULL # 100.00 +1 PRIMARY table2 NULL ALL PRIMARY,col_int_key,col_int_key_2 NULL NULL NULL # 100.00 Using where +1 PRIMARY <derived2> NULL ref key0 key0 9 test.table2.pk,test.table2.col_int_key # 100.00 +2 DERIVED SUBQUERY1_t2 NULL ALL PRIMARY,col_int_key,col_varchar_key,col_int_key_2 NULL NULL NULL # 57.89 Using where +2 DERIVED SUBQUERY1_t3 NULL ref PRIMARY,col_varchar_key col_varchar_key 5 test.SUBQUERY1_t2.col_varchar_key # 100.00 +2 DERIVED SUBQUERY1_t1 NULL ALL col_int_key,col_int_key_2 NULL NULL NULL # 100.00 Using where; Using join buffer (flat, BNL join) SELECT table1.pk AS field1 , table1.col_datetime_key AS field2 @@ -954,11 +954,11 @@ FROM ( cc AS SQ1_alias1 , c AS SQ1_alias2 ) GROUP BY SQ1_field1 , SQ1_field2 ) GROUP BY field1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY alias1 NULL index NULL col_int_key_3 10 NULL # Using index; Using temporary; Using filesort -1 PRIMARY alias2 NULL index NULL col_int_key_2 10 NULL # Using where; Using index; Using join buffer (flat, BNL join) -2 MATERIALIZED SQ1_alias1 NULL index col_int_key,col_int_key_2,col_int_key_3 col_int_key 5 NULL # Using index -2 MATERIALIZED SQ1_alias2 NULL ALL NULL NULL NULL NULL # 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 index NULL col_int_key_3 10 NULL # 100.00 Using index; Using temporary; Using filesort +1 PRIMARY alias2 NULL index NULL col_int_key_2 10 NULL # 100.00 Using where; Using index; Using join buffer (flat, BNL join) +2 MATERIALIZED SQ1_alias1 NULL index col_int_key,col_int_key_2,col_int_key_3 col_int_key 5 NULL # 100.00 Using index +2 MATERIALIZED SQ1_alias2 NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join) SELECT alias2 . col_varchar_key AS field1 FROM ( cc AS alias1 , cc AS alias2 ) @@ -1017,8 +1017,8 @@ KEY cover_key1 (col_int, col_varchar_255_utf8_key)); INSERT INTO j(col_int, pk, col_varchar_10_utf8) VALUES(9, 1, '951910400'), (-1934295040, 2, '1235025920'),(-584581120, 3, '-1176633344'),(3, 4, '1074462720'); EXPLAIN SELECT col_varchar_255_utf8_key FROM j ORDER BY 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE j NULL index NULL cover_key1 773 NULL # Using index; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE j NULL index NULL cover_key1 773 NULL # 100.00 Using index; Using filesort SELECT col_varchar_255_utf8_key FROM j ORDER BY col_varchar_255_utf8_key; col_varchar_255_utf8_key -117663334 @@ -1105,23 +1105,23 @@ INSERT INTO t1 (id) VALUES(NULL); ERROR 23000: Column 'id' cannot be null INSERT INTO t1 (id) VALUES(2),(3); EXPLAIN SELECT * FROM t1 FORCE INDEX(b) WHERE b=3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const b b 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const b b 5 const 1 100.00 EXPLAIN SELECT * FROM t1 AS t2 STRAIGHT_JOIN t1 FORCE INDEX(b) WHERE t1.b=t2.b; -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 eq_ref b b 5 test.t2.b 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL b NULL NULL NULL 2 100.00 Using where +1 SIMPLE t1 NULL eq_ref b b 5 test.t2.b 1 100.00 EXPLAIN SELECT b FROM t1 FORCE INDEX(b); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 5 NULL 2 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 2 100.00 Using index INSERT INTO t1 (id) VALUES(4),(5),(6),(7),(8),(9),(10); EXPLAIN SELECT b FROM t1 FORCE INDEX(b) WHERE b BETWEEN 1 AND 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range b b 5 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 5 NULL 3 100.00 Using where; Using index EXPLAIN SELECT * FROM t2 AS t1 WHERE b NOT IN (SELECT b FROM t1 FORCE INDEX(b)); -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 t1 NULL index_subquery b b 5 func 3 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 system NULL NULL NULL NULL 1 100.00 +2 SUBQUERY t1 NULL index_subquery b b 5 func 3 100.00 Using index; Full scan on NULL key DROP TABLE t1; DROP TABLE t2, t3; # @@ -1175,8 +1175,8 @@ UNIQUE KEY i0008 (a) INSERT INTO t(a,b) VALUES(1,'cccc'); EXPLAIN SELECT /*+ bka() */ 1 AS c FROM t AS b RIGHT JOIN t AS c ON b.a > c.c WHERE b.b>c.a; -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 +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: Warning 1292 Truncated incorrect DOUBLE value: 'cccc' Warning 1292 Truncated incorrect DOUBLE value: 'cccc' @@ -1211,8 +1211,8 @@ a0.i1 + a1.i1*10 FROM t0 AS a0, t0 AS a1, t0 AS a2; EXPLAIN SELECT * FROM t1 WHERE i1 > 41 AND i1 <= 43; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx idx 4 NULL 20 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx idx 4 NULL 20 100.00 Using index condition SELECT * FROM t1 WHERE i1 > 41 AND i1 <= 43; pk i1 i2 v1 v2 @@ -1239,8 +1239,8 @@ pk i1 i2 v1 v2 ALTER TABLE t1 ADD INDEX idx2(v1); EXPLAIN SELECT * FROM t1 WHERE v1 > 41 AND v1 <= 43; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx2 idx2 5 NULL # Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx2 idx2 5 NULL # 100.00 Using index condition SELECT * FROM t1 WHERE v1 > 41 AND v1 <= 43; pk i1 i2 v1 v2 @@ -1324,12 +1324,12 @@ WHERE t4.c1 < 'o' ) ) AND t1.i1 <= t3.i2_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 -1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 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 ALL distinct_key NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN @@ -1380,12 +1380,12 @@ WHERE t4.c1 < 'o' ) ) AND t1.i1 <= t3.i2_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 -1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx,v_idx2 PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 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 ALL distinct_key NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx,v_idx2 PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN @@ -1438,12 +1438,12 @@ WHERE t4.c1 < 'o' ) ) AND t1.i1 <= t3.i2_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 -1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx2 PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 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 ALL distinct_key NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx2 PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN @@ -1505,12 +1505,12 @@ WHERE t4.c1 < 'o' ) ) AND t1.i1 <= t3.i2_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 -1 PRIMARY <subquery2> NULL ALL distinct_key NULL NULL NULL 2 -1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 Using join buffer (flat, BNL join) -2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 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 ALL distinct_key NULL NULL NULL 2 100.00 +1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) +2 MATERIALIZED t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1, t3.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN @@ -1561,11 +1561,11 @@ WHERE t4.c1 < 'o' and t4.i1 < (t2.i1 + 1) ) ) AND t1.i1 <= t3.i2_key; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 Using where; Start temporary -1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) -1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 Using where -1 PRIMARY t2 NULL 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 filtered Extra +1 PRIMARY t4 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Start temporary +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join) +1 PRIMARY t3 NULL eq_ref PRIMARY,v_idx PRIMARY 4 test.t4.i1 1 100.00 Using where +1 PRIMARY t2 NULL ALL NULL NULL NULL NULL 5 100.00 Using where; End temporary; Using join buffer (flat, BNL join) SELECT /*+ NO_SEMIJOIN(@subq1) */ t1.c1, t2.i1 FROM t1 STRAIGHT_JOIN t3 STRAIGHT_JOIN t2 WHERE ( t3.pk IN diff --git a/mysql-test/suite/gcol/r/gcol_view_innodb.result b/mysql-test/suite/gcol/r/gcol_view_innodb.result index 153e8acd387..09cde88e563 100644 --- a/mysql-test/suite/gcol/r/gcol_view_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_view_innodb.result @@ -19,8 +19,8 @@ select is_updatable from information_schema.views where table_name='v1'; is_updatable NO explain select d,e from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL X 100.00 create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1; show create view v2; View Create View character_set_client collation_connection @@ -33,9 +33,9 @@ d e 2 2 3 3 explain select d,e from v2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 create view v3 (d,e) as select d*2, e*2 from v1; select * from v3; d e @@ -45,8 +45,8 @@ d e 4 4 6 6 explain select * from v3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL X 100.00 drop view v1,v2,v3; drop table t1; create table t1 (a int not null, @@ -60,9 +60,9 @@ b -2 -3 explain select * from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 Using temporary select * from t1; a b c 1 -1 -1 @@ -79,9 +79,9 @@ c -2 -3 explain select * from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 Using temporary select * from t1; a b c 1 -1 -1 @@ -102,9 +102,9 @@ b+1 0 -1 explain select * from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 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 X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 Using filesort drop view v1; create view v1 as select c+1 from t1 order by 1 desc limit 2; select * from v1; @@ -112,9 +112,9 @@ c+1 -1 0 explain select * from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 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 X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 Using filesort drop view v1; drop table t1; create table t1 (a int, diff --git a/mysql-test/suite/gcol/r/gcol_view_myisam.result b/mysql-test/suite/gcol/r/gcol_view_myisam.result index 1a255649894..85df2acb053 100644 --- a/mysql-test/suite/gcol/r/gcol_view_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_view_myisam.result @@ -19,8 +19,8 @@ select is_updatable from information_schema.views where table_name='v1'; is_updatable NO explain select d,e from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL X 100.00 create algorithm=temptable view v2 (d,e) as select abs(b), abs(c) from t1; show create view v2; View Create View character_set_client collation_connection @@ -33,9 +33,9 @@ d e 2 2 3 3 explain select d,e from v2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 create view v3 (d,e) as select d*2, e*2 from v1; select * from v3; d e @@ -45,8 +45,8 @@ d e 4 4 6 6 explain select * from v3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL X +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL X 100.00 drop view v1,v2,v3; drop table t1; create table t1 (a int not null, @@ -60,9 +60,9 @@ b -2 -3 explain select * from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 Using temporary select * from t1; a b c 1 -1 -1 @@ -79,9 +79,9 @@ c -2 -3 explain select * from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X Using temporary +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 Using temporary select * from t1; a b c 1 -1 -1 @@ -102,9 +102,9 @@ b+1 0 -1 explain select * from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 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 X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 Using filesort drop view v1; create view v1 as select c+1 from t1 order by 1 desc limit 2; select * from v1; @@ -112,9 +112,9 @@ c+1 -1 0 explain select * from v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL X -2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 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 X 100.00 +2 DERIVED t1 NULL ALL NULL NULL NULL NULL X 100.00 Using filesort drop view v1; drop table t1; create table t1 (a int, diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk.result b/mysql-test/suite/gcol/r/innodb_virtual_fk.result index ab87ee99b1e..00f9aeecf00 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_fk.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_fk.result @@ -596,8 +596,8 @@ KEY (f1, f2), FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=INNODB; INSERT INTO t1 VALUES(1); INSERT INTO t2(f1) VALUES(1); EXPLAIN SELECT f1, f2 FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL f1 9 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL f1 9 NULL 1 100.00 Using index SELECT f1, f2 FROM t2; f1 f2 1 1 @@ -611,15 +611,15 @@ ON UPDATE CASCADE)ENGINE=INNODB; INSERT INTO t1 VALUES(1); INSERT INTO t2(f1) VALUES(1); EXPLAIN SELECT f1, f2 FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL f1 9 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL f1 9 NULL 1 100.00 Using index SELECT f1, f2 FROM t2; f1 f2 1 1 UPDATE t1 SET f1 = 2 WHERE f1 = 1; EXPLAIN SELECT f1, f2 FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL f1 9 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL f1 9 NULL 1 100.00 Using index SELECT f1, f2 FROM t2; f1 f2 2 2 @@ -635,8 +635,8 @@ ON UPDATE CASCADE, ALGORITHM=INPLACE; SET FOREIGN_KEY_CHECKS = 1; UPDATE t1 SET f1 = 3; EXPLAIN SELECT f1, f2 FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL f1 9 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL f1 9 NULL 1 100.00 Using index SELECT f1, f2 FROM t2; f1 f2 3 3 @@ -650,8 +650,8 @@ ALTER TABLE t2 ADD FOREIGN KEY (f1) REFERENCES t1(f1) ON UPDATE CASCADE, ALGORITHM=COPY; UPDATE t1 SET f1 = 3; EXPLAIN SELECT f1, f2 FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL f1 9 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL f1 9 NULL 1 100.00 Using index SELECT f1, f2 FROM t2; f1 f2 3 3 @@ -666,8 +666,8 @@ INSERT INTO t2(f1) VALUES(1); ALTER TABLE t2 DROP COLUMN f2, ALGORITHM=INPLACE; UPDATE t1 SET f1 = 3; EXPLAIN SELECT f1, f3 FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL idx1 9 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx1 9 NULL 1 100.00 Using index SELECT f1, f3 FROM t2; f1 f3 3 2 @@ -682,8 +682,8 @@ INSERT INTO t2(f1) VALUES(1); ALTER TABLE t2 DROP COLUMN f2, ALGORITHM=COPY; UPDATE t1 SET f1 = 3; EXPLAIN SELECT f1, f3 FROM t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL idx1 9 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL index NULL idx1 9 NULL 1 100.00 Using index SELECT f1, f3 FROM t2; f1 f3 3 2 diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result index 9ae656ea8c8..d242a2a86a5 100644 --- a/mysql-test/suite/heap/heap.result +++ b/mysql-test/suite/heap/heap.result @@ -65,8 +65,8 @@ a 869751 alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range uniq_id uniq_id 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uniq_id uniq_id 4 NULL 4 100.00 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x (x), unique y (y)) engine=heap; @@ -84,9 +84,9 @@ x y x y 2 5 2 2 2 6 2 2 explain select * from t1,t1 as t2 where t1.x=t2.y; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL x NULL NULL NULL 6 -1 SIMPLE t2 NULL eq_ref y y 4 test.t1.x 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL x NULL NULL NULL 6 100.00 +1 SIMPLE t2 NULL eq_ref y y 4 test.t1.x 1 100.00 drop table t1; create table t1 (a int) engine=heap; insert into t1 values(1); @@ -158,18 +158,18 @@ drop table t1; create table t1 (btn char(10) not null, key(btn)) engine=heap; insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); explain select * from t1 where btn like "q%"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL btn NULL NULL NULL 14 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL btn NULL NULL NULL 14 100.00 Using where select * from t1 where btn like "q%"; btn alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn; update t1 set new_col=left(btn,1); explain select * from t1 where btn="a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL btn NULL NULL NULL 14 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL btn NULL NULL NULL 14 100.00 Using where explain select * from t1 where btn="a" and new_col="a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref btn btn 11 const,const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref btn btn 11 const,const 2 100.00 Using where drop table t1; CREATE TABLE t1 ( a int default NULL, @@ -181,16 +181,16 @@ INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); SELECT * FROM t1 WHERE a=NULL; a b explain SELECT * FROM t1 WHERE a IS NULL; -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 where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 2 100.00 Using where SELECT * FROM t1 WHERE a<=>NULL; a b NULL 99 SELECT * FROM t1 WHERE b=NULL; a b explain SELECT * FROM t1 WHERE b IS NULL; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref b b 5 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b b 5 const 1 100.00 Using where SELECT * FROM t1 WHERE b<=>NULL; a b 99 NULL @@ -203,8 +203,8 @@ key a (a) ) ENGINE=HEAP; INSERT INTO t1 VALUES (10), (10), (10); EXPLAIN SELECT * FROM t1 WHERE a=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 5 const 3 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 3 100.00 SELECT * FROM t1 WHERE a=10; a 10 @@ -367,23 +367,23 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const 10 100.00 Using where explain select count(*) from t1 where c='a '; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref c c 11 const 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c c 11 const 10 100.00 Using where explain select count(*) from t1 where t='a '; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref t t 13 const 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref t t 13 const 10 100.00 Using where explain select count(*) from t1 where v like 'a%'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL v NULL NULL NULL 271 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL v NULL NULL NULL 271 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const 10 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const 10 100.00 Using where alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*')); @@ -399,8 +399,8 @@ qq *a *a*a * *a *a*a * explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const 10 100.00 Using where select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -590,23 +590,23 @@ select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\ count(*) 7 explain select count(*) from t1 where v='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where explain select count(*) from t1 where c='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c c 11 const # 100.00 Using where explain select count(*) from t1 where t='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref t t 13 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 13 NULL # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a' order by length(concat('*',v,'*',c,'*',t,'*')); @@ -619,8 +619,8 @@ qq *a *a*a * *a *a*a * explain select * from t1 where v='a'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where drop table t1; create table t1 (a char(10), unique using btree (a)) engine=heap; insert into t1 values ('a'); @@ -792,10 +792,10 @@ col_int_nokey # shouldn't crash EXPLAIN SELECT col_int_nokey FROM t2 WHERE ('h', 0) NOT IN ( SELECT * FROM v1); -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 <derived3> NULL ALL NULL NULL NULL NULL 2 Using where -3 DERIVED t1 NULL range PRIMARY PRIMARY 4 NULL 1 Using index condition; 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 +2 SUBQUERY <derived3> NULL ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED t1 NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition; Using where DROP TABLE t1,t2,h1; DROP VIEW v1; CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; diff --git a/mysql-test/suite/heap/heap_btree.result b/mysql-test/suite/heap/heap_btree.result index 318c6e326f5..4113cf4fc5f 100644 --- a/mysql-test/suite/heap/heap_btree.result +++ b/mysql-test/suite/heap/heap_btree.result @@ -64,19 +64,19 @@ a 802616 869751 explain select * from t1 where a in (869751,736494,226312,802616); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range uniq_id uniq_id 4 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uniq_id uniq_id 4 NULL 4 100.00 Using where alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range uniq_id uniq_id 4 NULL 4 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uniq_id uniq_id 4 NULL 4 100.00 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y)) engine=heap; insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6); explain select * from t1 where x=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref x x 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref x x 4 const 1 100.00 select * from t1 where x=1; x y 1 1 @@ -90,9 +90,9 @@ x y x y 2 5 2 2 2 6 2 2 explain select * from t1,t1 as t2 where t1.x=t2.y; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL x NULL NULL NULL 6 -1 SIMPLE t2 NULL eq_ref y y 4 test.t1.x 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL x NULL NULL NULL 6 100.00 +1 SIMPLE t2 NULL eq_ref y y 4 test.t1.x 1 100.00 drop table t1; create table t1 (a int) engine=heap; insert into t1 values(1); @@ -126,18 +126,18 @@ a b 1 6 1 6 explain select * from tx where a=x order by a,b; -id select_type table partitions type possible_keys key key_len ref rows Extra -x SIMPLE tx NULL ref a a x const x Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x SIMPLE tx NULL ref a a x const x xx.xx Using where explain select * from tx where a=x order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -x SIMPLE tx NULL ref a a x const x Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x SIMPLE tx NULL ref a a x const x xx.xx Using where select * from t1 where b=1; a b 1 1 1 1 explain select * from tx where b=x; -id select_type table partitions type possible_keys key key_len ref rows Extra -x SIMPLE tx NULL ref b b x const x +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +x SIMPLE tx NULL ref b b x const x xx.xx drop table t1; create table t1 (id int unsigned not null, primary key using BTREE (id)) engine=HEAP; insert into t1 values(1); @@ -177,17 +177,17 @@ drop table t1; create table t1 (btn char(10) not null, key using BTREE (btn)) engine=heap; insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("hello"),("hello"), ("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); explain select * from t1 where btn like "i%"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range btn btn 10 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range btn btn 10 NULL 1 100.00 Using where explain select * from t1 where btn like "h%"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range btn btn 10 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range btn btn 10 NULL # 100.00 Using where explain select * from t1 where btn like "a%"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range btn btn 10 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range btn btn 10 NULL 1 100.00 Using where explain select * from t1 where btn like "b%"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range btn btn 10 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range btn btn 10 NULL 1 100.00 Using where select * from t1 where btn like "ff%"; btn select * from t1 where btn like " %"; @@ -197,11 +197,11 @@ btn alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn; update t1 set new_col=left(btn,1); explain select * from t1 where btn="a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref btn btn 10 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref btn btn 10 const 1 100.00 Using where explain select * from t1 where btn="a" and new_col="a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref btn btn 11 const,const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref btn btn 11 const,const 1 100.00 Using where drop table t1; CREATE TABLE t1 ( a int default NULL, @@ -213,16 +213,16 @@ INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); SELECT * FROM t1 WHERE a=NULL; a b explain SELECT * FROM t1 WHERE a IS NULL; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 1 100.00 Using where SELECT * FROM t1 WHERE a<=>NULL; a b NULL 99 SELECT * FROM t1 WHERE b=NULL; a b explain SELECT * FROM t1 WHERE b IS NULL; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref b b 5 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b b 5 const 1 100.00 Using where SELECT * FROM t1 WHERE b<=>NULL; a b 99 NULL @@ -356,21 +356,21 @@ select 0+a from t1 where a > 736494; 802616 869751 explain select 0+a from t1 where a > 736494; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 3 100.00 Using where select 0+a from t1 where a = 736494; 0+a 736494 explain select 0+a from t1 where a = 736494; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const uniq_id uniq_id 8 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const uniq_id uniq_id 8 const 1 100.00 select 0+a from t1 where a=869751 or a=736494; 0+a 736494 869751 explain select 0+a from t1 where a=869751 or a=736494; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 2 100.00 Using where insert into t1 (a) select * from seq_1_to_100; select 0+a from t1 where a in (869751,736494,226312,802616); 0+a @@ -379,8 +379,8 @@ select 0+a from t1 where a in (869751,736494,226312,802616); 802616 869751 explain select 0+a from t1 where a in (869751,736494,226312,802616); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 4 100.00 Using where drop table t1; End of 5.3 tests create table t1 (id int, a varchar(300) not null, key using btree(a)) engine=heap; diff --git a/mysql-test/suite/heap/heap_hash.result b/mysql-test/suite/heap/heap_hash.result index 659da48ce22..fc8d04534c5 100644 --- a/mysql-test/suite/heap/heap_hash.result +++ b/mysql-test/suite/heap/heap_hash.result @@ -64,8 +64,8 @@ a 869751 alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL uniq_id NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL uniq_id NULL NULL NULL 5 100.00 Using where drop table t1; create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y)) engine=heap; @@ -83,9 +83,9 @@ x y x y 2 5 2 2 2 6 2 2 explain select * from t1,t1 as t2 where t1.x=t2.y; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL x NULL NULL NULL 6 -1 SIMPLE t2 NULL eq_ref y y 4 test.t1.x 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL x NULL NULL NULL 6 100.00 +1 SIMPLE t2 NULL eq_ref y y 4 test.t1.x 1 100.00 drop table t1; create table t1 (a int) engine=heap; insert into t1 values(1); @@ -157,18 +157,18 @@ drop table t1; create table t1 (btn char(10) not null, key using HASH (btn)) engine=heap; insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i"); explain select * from t1 where btn like "q%"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL btn NULL NULL NULL 14 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL btn NULL NULL NULL 14 100.00 Using where select * from t1 where btn like "q%"; btn alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn; update t1 set new_col=left(btn,1); explain select * from t1 where btn="a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL btn NULL NULL NULL 14 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL btn NULL NULL NULL 14 100.00 Using where explain select * from t1 where btn="a" and new_col="a"; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref btn btn 11 const,const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref btn btn 11 const,const 2 100.00 Using where drop table t1; CREATE TABLE t1 ( a int default NULL, @@ -180,16 +180,16 @@ INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3); SELECT * FROM t1 WHERE a=NULL; a b explain SELECT * FROM t1 WHERE a IS NULL; -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 where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 5 const 2 100.00 Using where SELECT * FROM t1 WHERE a<=>NULL; a b NULL 99 SELECT * FROM t1 WHERE b=NULL; a b explain SELECT * FROM t1 WHERE b IS NULL; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref b b 5 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b b 5 const 1 100.00 Using where SELECT * FROM t1 WHERE b<=>NULL; a b 99 NULL @@ -218,59 +218,59 @@ insert into t1 values ('aaaf', 'prefill-hash=4',0); insert into t1 values ('aaag', 'prefill-hash=3',0); insert into t1 values ('aaah', 'prefill-hash=6',0); explain select * from t1 where a='aaaa'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaab'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaac'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaad'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where insert into t1 select * from t1; flush tables; explain select * from t1 where a='aaaa'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaab'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaac'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaad'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where flush tables; explain select * from t1 where a='aaaa'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaab'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaac'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaad'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where create table t2 as select * from t1; delete from t1; insert into t1 select * from t2; explain select * from t1 where a='aaaa'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaab'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaac'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where explain select * from t1 where a='aaad'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 8 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 8 const 2 100.00 Using where drop table t1, t2; create table t1 ( id int unsigned not null primary key auto_increment, @@ -289,29 +289,29 @@ insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'), ('Emily'), ('Mike'); insert into t2 select * from t1; explain select * from t1 where name='matt'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref heap_idx,btree_idx btree_idx 22 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref heap_idx,btree_idx btree_idx 22 const 1 100.00 Using where explain select * from t2 where name='matt'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref btree_idx,heap_idx btree_idx 22 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref btree_idx,heap_idx btree_idx 22 const 1 100.00 Using where explain select * from t1 where name='Lilu'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref heap_idx,btree_idx btree_idx 22 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref heap_idx,btree_idx btree_idx 22 const 1 100.00 Using where explain select * from t2 where name='Lilu'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref btree_idx,heap_idx btree_idx 22 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref btree_idx,heap_idx btree_idx 22 const 1 100.00 Using where explain select * from t1 where name='Phil'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref heap_idx,btree_idx btree_idx 22 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref heap_idx,btree_idx btree_idx 22 const 1 100.00 Using where explain select * from t2 where name='Phil'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref btree_idx,heap_idx btree_idx 22 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref btree_idx,heap_idx btree_idx 22 const 1 100.00 Using where explain select * from t1 where name='Lilu'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref heap_idx,btree_idx btree_idx 22 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref heap_idx,btree_idx btree_idx 22 const 1 100.00 Using where explain select * from t2 where name='Lilu'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref btree_idx,heap_idx btree_idx 22 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref btree_idx,heap_idx btree_idx 22 const 1 100.00 Using where insert into t1 (name) select name from t2; insert into t1 (name) select name from t2; insert into t1 (name) select name from t2; @@ -323,8 +323,8 @@ select count(*) from t1 where name='Matt'; count(*) 7 explain select * from t1 ignore index (btree_idx) where name='matt'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref heap_idx heap_idx 22 const 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref heap_idx heap_idx 22 const 7 100.00 Using where show index 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 0 PRIMARY 1 id NULL 91 NULL NULL HASH NO @@ -351,9 +351,9 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par t3 1 a 1 a NULL NULL NULL NULL HASH NO t3 1 a 2 b NULL 13 NULL NULL HASH NO explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref heap_idx heap_idx 22 const 7 Using where -1 SIMPLE t3 NULL ref a a 44 func,const 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref heap_idx heap_idx 22 const 7 100.00 Using where +1 SIMPLE t3 NULL ref a a 44 func,const 7 100.00 Using where drop table t1, t2, t3; create temporary table t1 ( a int, index (a) ) engine=memory; insert into t1 values (1),(2),(3),(4),(5); @@ -362,8 +362,8 @@ a 1 3 explain select a from t1 where a in (1,3); -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 +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 drop table t1; End of 4.1 tests CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, @@ -392,8 +392,8 @@ INSERT INTO t1 VALUES (2, NULL); INSERT INTO t1 VALUES (3, 1); INSERT INTO t1 VALUES (4, NULL); EXPLAIN SELECT * FROM t1 WHERE val IS NULL; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref val val 5 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref val val 5 const 1 100.00 Using where SELECT * FROM t1 WHERE val IS NULL; pk val 4 NULL @@ -410,21 +410,21 @@ select 0+a from t1 where a > 736494; 869751 802616 explain select 0+a from t1 where a > 736494; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL uniq_id NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL uniq_id NULL NULL NULL 5 100.00 Using where select 0+a from t1 where a = 736494; 0+a 736494 explain select 0+a from t1 where a = 736494; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const uniq_id uniq_id 8 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const uniq_id uniq_id 8 const 1 100.00 select 0+a from t1 where a=869751 or a=736494; 0+a 736494 869751 explain select 0+a from t1 where a=869751 or a=736494; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 2 100.00 Using where select 0+a from t1 where a in (869751,736494,226312,802616,728912); 0+a 226312 @@ -433,8 +433,8 @@ select 0+a from t1 where a in (869751,736494,226312,802616,728912); 802616 869751 explain select 0+a from t1 where a in (869751,736494,226312,802616,728912); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range uniq_id uniq_id 8 NULL 5 100.00 Using where drop table t1; End of 5.3 tests # @@ -453,15 +453,15 @@ DROP TABLE t1; CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, KEY i1 (c1(3))) ENGINE=MEMORY DEFAULT CHARSET=latin1; INSERT INTO t1 VALUES ('foo1'), ('bar2'), ('baz3'); explain SELECT * FROM t1 WHERE c1='bar2'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref i1 i1 5 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref i1 i1 5 const 2 100.00 Using where SELECT * FROM t1 WHERE c1='bar2'; c1 bar2 ALTER TABLE t1 DROP KEY i1, ADD KEY il (c1(3)) using btree; explain SELECT * FROM t1 WHERE c1='bar2'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref il il 5 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref il il 5 const 1 100.00 Using where SELECT * FROM t1 WHERE c1='bar2'; c1 bar2 diff --git a/mysql-test/suite/innodb/r/innodb-dict.result b/mysql-test/suite/innodb/r/innodb-dict.result index 78f26c19695..a654af85f94 100644 --- a/mysql-test/suite/innodb/r/innodb-dict.result +++ b/mysql-test/suite/innodb/r/innodb-dict.result @@ -17,11 +17,11 @@ INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; EXPLAIN SELECT d FROM t1 WHERE d = 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref my_d my_d 5 const 128 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref my_d my_d 5 const 128 100.00 Using index EXPLAIN SELECT D FROM t1 WHERE D = 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref my_d my_d 5 const 128 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref my_d my_d 5 const 128 100.00 Using index ALTER TABLE t1 DROP INDEX my_d; ALTER TABLE t1 MODIFY COLUMN D INT; ANALYZE TABLE t1; @@ -30,11 +30,11 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK ALTER TABLE t1 ADD INDEX my_d (D); EXPLAIN SELECT d FROM t1 WHERE d = 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref my_d my_d 5 const 128 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref my_d my_d 5 const 128 100.00 Using index EXPLAIN SELECT D FROM t1 WHERE D = 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref my_d my_d 5 const 128 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref my_d my_d 5 const 128 100.00 Using index SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result index 766d22e0ad5..55c2923f7af 100644 --- a/mysql-test/suite/innodb/r/innodb-index-online.result +++ b/mysql-test/suite/innodb/r/innodb-index-online.result @@ -185,8 +185,8 @@ INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1; INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1; INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1; EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3; -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 +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 ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected @@ -207,8 +207,8 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par t1 0 PRIMARY 1 c1 A 80 NULL NULL BTREE NO t1 1 c2d 1 c2 A 10 NULL NULL YES BTREE NO EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range c2d c2d 5 NULL 32 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c2d c2d 5 NULL 32 100.00 Using where; Using index SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index 1edf07859ac..e0a3850055a 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -26,8 +26,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1 analyze table t1; explain select * from t1 force index(d2) order by d; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL d2 23 NULL 4 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL d2 23 NULL 4 100.00 select * from t1 force index (d2) order by d; a b c d 3 4 ad ad @@ -80,8 +80,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 force index(c) order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 10 NULL 4 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 10 NULL 4 100.00 alter table t1 add primary key (a), drop index c; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -123,8 +123,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 force index(c) order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 10 NULL 4 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 10 NULL 4 100.00 select * from t1 force index(c) order by c; a b c d 3 4 ad ad @@ -178,14 +178,14 @@ a b c d 4 4 tr tr analyze table t1; explain select * from t1 force index(b) order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 5 NULL 5 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 5 100.00 explain select * from t1 force index(c) order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 10 NULL 5 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 10 NULL 5 100.00 explain select * from t1 force index(d) order by d; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL d 23 NULL 5 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL d 23 NULL 5 100.00 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -256,14 +256,14 @@ a b c d 4 4 afe afe 5 1 ggg ggg explain select * from t1 order by b; -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 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 explain select * from t1 force index(c) order by c; -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 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 explain select * from t1 force index(d) order by d; -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 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 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -297,14 +297,14 @@ a b c d 5 1 ggg ggg analyze table t1; explain select * from t1 order by b; -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 +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 explain select * from t1 force index(c) order by c; -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 +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 explain select * from t1 order by d; -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 +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 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -339,8 +339,8 @@ a b c d 8 9 fff fff analyze table t1; explain select * from t1 force index(b) order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 16 NULL 5 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 16 NULL 5 100.00 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -373,8 +373,8 @@ a b c d 11 11 kkk kkk analyze table t1; explain select * from t1 force index(b) order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 16 NULL 6 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 16 NULL 6 100.00 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -419,11 +419,11 @@ a b c d 13 13 yyy aaa analyze table t1; explain select * from t1 force index(b) order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 16 NULL 7 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 16 NULL 7 100.00 explain select * from t1 force index(c) order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 34 NULL 7 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 34 NULL 7 100.00 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -599,8 +599,8 @@ a b c d 8 9 fff fff 10 10 kkk iii explain select * from t1 force index(b) order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 5 NULL 6 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 6 100.00 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -650,14 +650,14 @@ a b c d 10 10 kkk iii 11 11 aaa mmm explain select * from t1 force index(b) order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 5 NULL 7 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 7 100.00 explain select * from t1 force index(c) order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 31 NULL 7 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 31 NULL 7 100.00 explain select * from t1 force index(d) order by d; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL d 63 NULL 7 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL d 63 NULL 7 100.00 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -748,14 +748,14 @@ Table Op Msg_type Msg_text test.t1 check status OK analyze table t1; explain select * from t1 force index(c) order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 9 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 9 100.00 explain select * from t1 order by a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 9 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 9 100.00 explain select * from t1 force index(b) order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 4 NULL 9 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 4 NULL 9 100.00 select * from t1 order by a; a b c 1 5 1 @@ -815,14 +815,14 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 100.00 explain select * from t1 order by a; -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 +id select_type 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 explain select * from t1 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 100.00 checksum table t1; Table Checksum test.t1 582702641 @@ -852,11 +852,11 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index explain select * from t1 order by a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index drop table t1; SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET FOREIGN_KEY_CHECKS=0; diff --git a/mysql-test/suite/innodb/r/innodb-index_ucs2.result b/mysql-test/suite/innodb/r/innodb-index_ucs2.result index fac027dde96..fb0e7050467 100644 --- a/mysql-test/suite/innodb/r/innodb-index_ucs2.result +++ b/mysql-test/suite/innodb/r/innodb-index_ucs2.result @@ -39,8 +39,8 @@ a b c d 8 9 fff fff 10 10 kkk iii explain select * from t1 force index(b) order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 5 NULL 6 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 6 100.00 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -90,14 +90,14 @@ a b c d 10 10 kkk iii 11 11 aaa mmm explain select * from t1 force index(b) order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL b 5 NULL 7 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 5 NULL 7 100.00 explain select * from t1 force index(c) order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 21 NULL 7 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 21 NULL 7 100.00 explain select * from t1 force index(d) order by d; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL d 43 NULL 7 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL d 43 NULL 7 100.00 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/innodb/r/innodb-isolation.result b/mysql-test/suite/innodb/r/innodb-isolation.result index 2f63862e9ea..e6429ee6df6 100644 --- a/mysql-test/suite/innodb/r/innodb-isolation.result +++ b/mysql-test/suite/innodb/r/innodb-isolation.result @@ -938,41 +938,41 @@ COUNT(*) # Show The EXPLAIN output for these queries; # EXPLAIN SELECT * FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # +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.00 EXPLAIN SELECT COUNT(*) FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL k2 5 NULL # Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k2 5 NULL # 100.00 Using index EXPLAIN SELECT COUNT(c1) FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL k2 5 NULL # Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k2 5 NULL # 100.00 Using index EXPLAIN SELECT COUNT(c2) FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL k2 5 NULL # Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k2 5 NULL # 100.00 Using index EXPLAIN SELECT COUNT(c3) FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # +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.00 EXPLAIN SELECT SUM(c1) FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL k2 5 NULL # Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k2 5 NULL # 100.00 Using index EXPLAIN SELECT SUM(c2) FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL k2 5 NULL # Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k2 5 NULL # 100.00 Using index EXPLAIN SELECT AVG(c1), MAX(c1), MIN(c2), AVG(c3), SUM(c4) FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # +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.00 EXPLAIN SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL range PRIMARY PRIMARY 4 NULL # Using where -2 SUBQUERY t1 NULL index NULL k2 5 NULL # 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 # 100.00 Using where +2 SUBQUERY t1 NULL index NULL k2 5 NULL # 100.00 Using index EXPLAIN SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL range PRIMARY PRIMARY 4 NULL # Using where -2 SUBQUERY t1 NULL index NULL k2 5 NULL # 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 # 100.00 Using where +2 SUBQUERY t1 NULL index NULL k2 5 NULL # 100.00 Using index EXPLAIN SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL range PRIMARY PRIMARY 4 NULL # Using where; Using index -2 SUBQUERY t1 NULL index NULL k2 5 NULL # 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 # 100.00 Using where; Using index +2 SUBQUERY t1 NULL index NULL k2 5 NULL # 100.00 Using index # # Make all indexes in t2 obsolete to the active repeatable read transaction # in the default connection. @@ -1401,17 +1401,17 @@ INSERT INTO t1(c1) SELECT c1 + 10 FROM t1; INSERT INTO t1(c1) SELECT c1 + 100 FROM t1; CREATE TABLE t2 STATS_PERSISTENT=0 SELECT * FROM t1; EXPLAIN SELECT COUNT(*) FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c2_idx 4 NULL 12 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c2_idx 4 NULL 12 100.00 Using index EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c2_idx 4 NULL 12 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c2_idx 4 NULL 12 100.00 Using index EXPLAIN SELECT COUNT(*) FROM t1, t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c2_idx 4 NULL 12 Using index -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 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 c2_idx 4 NULL 12 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 100.00 Using join buffer (flat, BNL join) EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(c2_idx), t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c2_idx 4 NULL 12 Using index -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 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 c2_idx 4 NULL 12 100.00 Using index +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 12 100.00 Using join buffer (flat, BNL join) DROP TABLE t1, t2; diff --git a/mysql-test/suite/innodb/r/innodb-table-online.result b/mysql-test/suite/innodb/r/innodb-table-online.result index 4a1102cb637..bb7cb41df3c 100644 --- a/mysql-test/suite/innodb/r/innodb-table-online.result +++ b/mysql-test/suite/innodb/r/innodb-table-online.result @@ -172,8 +172,8 @@ INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1; INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1; INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1; EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL ROWS 80 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL ROWS 100.00 Using where ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index 668d804886d..c29a86001e5 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -146,14 +146,14 @@ id parent_id level 1010 102 2 1015 102 2 explain select level from t1 where level=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref level level 1 const # 100.00 Using index explain select level,id from t1 where level=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref level level 1 const # 100.00 Using index explain select level,id,parent_id from t1 where level=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref level level 1 const # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref level level 1 const # 100.00 select level,id from t1 where level=1; level id 1 1002 @@ -616,8 +616,8 @@ id parent_id level 1025 102 2 1016 102 2 explain select level from t1 where level=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref level level 1 const # 100.00 Using index select level,id from t1 where level=1; level id 1 1004 @@ -785,8 +785,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 = innodb; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL # 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 # 100.00 Using index condition 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=innodb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); @@ -921,29 +921,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=innodb; 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL # 100.00 explain select * from t1 order by b; -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 +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.00 Using filesort explain select * from t1 order by c; -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 +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.00 Using filesort explain select a from t1 order by a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL # 100.00 Using index explain select b from t1 order by b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 4 NULL # 100.00 Using index explain select a,b from t1 order by b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 4 NULL # 100.00 Using index explain select a,b from t1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 4 NULL # 100.00 Using index explain select a,b,c from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL # +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.00 drop table t1; create table t1 (t int not null default 1, key (t)) engine=innodb; desc t1; @@ -1230,12 +1230,12 @@ select count(*) from t1; count(*) 623 explain select * from t1 where c between 1 and 2500; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range c c 5 NULL # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range c c 5 NULL # # Using index condition; Rowid-ordered scan update t1 set c=a; explain select * from t1 where c between 1 and 2500; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL c NULL NULL NULL # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL c NULL NULL NULL # # Using where drop table t1,t2; create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; insert into t1 (id) values (null),(null),(null),(null),(null); @@ -1641,8 +1641,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 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 drop table t1; create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; insert into t1 values ('8', '6'), ('4', '7'); @@ -1675,8 +1675,8 @@ select count(*) from t1 where x = -16; count(*) 0 explain select count(*) from t1 where x > -16; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index PRIMARY PRIMARY 8 NULL 2 100.00 Using where; Using index select count(*) from t1 where x > -16; count(*) 2 @@ -1838,23 +1838,23 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where; Using index explain select count(*) from t1 where c='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c c 11 const # 100.00 Using where; Using index explain select count(*) from t1 where t='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref t t 13 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 13 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where; Using index alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' show warnings; @@ -1876,8 +1876,8 @@ qq *a *a*a * *a *a*a * explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v,v_2 # 13 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v,v_2 # 13 const # # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -2040,20 +2040,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 303 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -2120,20 +2120,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 33 NULL # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 33 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # # Using where select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -2291,8 +2291,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref ba ba 20 const,const 1 100.00 Using where; Using index select * from t1 where a=20 and b is null; a b 20 NULL diff --git a/mysql-test/suite/innodb/r/innodb_bug30423.result b/mysql-test/suite/innodb/r/innodb_bug30423.result index 0854099a83e..5bb1d579b61 100644 --- a/mysql-test/suite/innodb/r/innodb_bug30423.result +++ b/mysql-test/suite/innodb/r/innodb_bug30423.result @@ -53,10 +53,10 @@ LEFT JOIN bug30243_3 sa_opportunities ON orgs.org_id=sa_opportunities.org_id LEFT JOIN bug30243_2 contacts ON orgs.org_id=contacts.org_id ; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE orgs NULL index NULL org_id 4 NULL ROWS Using index -1 SIMPLE sa_opportunities NULL ref org_id org_id 5 test.orgs.org_id ROWS Using index -1 SIMPLE contacts NULL ref contacts$org_id contacts$org_id 5 test.orgs.org_id ROWS Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orgs NULL index NULL org_id 4 NULL ROWS 100.00 Using index +1 SIMPLE sa_opportunities NULL ref org_id org_id 5 test.orgs.org_id ROWS 100.00 Using index +1 SIMPLE contacts NULL ref contacts$org_id contacts$org_id 5 test.orgs.org_id ROWS 100.00 Using index select @@innodb_stats_method; @@innodb_stats_method nulls_ignored @@ -82,10 +82,10 @@ LEFT JOIN bug30243_3 sa_opportunities ON orgs.org_id=sa_opportunities.org_id LEFT JOIN bug30243_2 contacts ON orgs.org_id=contacts.org_id; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE orgs NULL index NULL org_id 4 NULL ROWS Using index -1 SIMPLE sa_opportunities NULL ref org_id org_id 5 test.orgs.org_id ROWS Using index -1 SIMPLE contacts NULL ref contacts$org_id contacts$org_id 5 test.orgs.org_id ROWS Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE orgs NULL index NULL org_id 4 NULL ROWS 100.00 Using index +1 SIMPLE sa_opportunities NULL ref org_id org_id 5 test.orgs.org_id ROWS 100.00 Using index +1 SIMPLE contacts NULL ref contacts$org_id contacts$org_id 5 test.orgs.org_id ROWS 100.00 Using index SELECT COUNT(*) FROM table_bug30423 WHERE org_id IS NULL; COUNT(*) 1024 diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result index 1e891fc28d5..40a801d93f9 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result @@ -29,11 +29,11 @@ CREATE INDEX idx_id ON t1(id); CREATE INDEX idx_title ON t1(title); /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result index feb6d62aeed..9dd6c475206 100644 --- a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result +++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result @@ -28,11 +28,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 @@ -91,11 +91,11 @@ Table Op Msg_type Msg_text test.t1 check status OK /* Select by index. */ EXPLAIN SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_id idx_id 5 const 1 100.00 EXPLAIN SELECT * FROM t1 WHERE title = 'a10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx_title idx_title 103 const 1 100.00 Using index condition SELECT * FROM t1 WHERE id = 10; class id title 10 10 a10 diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result index 7892089b30c..f6070a22ae9 100644 --- a/mysql-test/suite/innodb/r/innodb_gis.result +++ b/mysql-test/suite/innodb/r/innodb_gis.result @@ -555,8 +555,8 @@ COUNT(*) 1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref p p 28 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref p p 28 const 1 100.00 Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 @@ -564,22 +564,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref p p 28 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref p p 28 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 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 SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 @@ -602,8 +602,8 @@ drop table t1; create table t1(id int not null primary key, g1 geometry not null, spatial index(g1)); insert into t1 values(1, polygonfromtext('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))')); explain select id from t1 where contains(g1, pointfromtext('POINT(1 1)')); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g1 g1 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g1 g1 34 NULL 1 100.00 Using where select id from t1 where contains(g1, pointfromtext('POINT(1 1)')); id 1 diff --git a/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result b/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result index cf8c9b2dc5e..5d66ab74f46 100644 --- a/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result +++ b/mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result @@ -118,6 +118,7 @@ key NULL key_len NULL ref NULL rows 2 +filtered 100.00 Extra id 1 select_type PRIMARY @@ -129,6 +130,7 @@ key PRIMARY key_len 4 ref t2.a rows 1 +filtered 100.00 Extra Using where id 2 select_type DERIVED @@ -140,6 +142,7 @@ key NULL key_len NULL ref NULL rows NULL +filtered NULL Extra No tables used id 3 select_type UNION @@ -151,6 +154,7 @@ key NULL key_len NULL ref NULL rows NULL +filtered NULL Extra No tables used # # Demonstrate that the reported SELECT statement @@ -313,6 +317,7 @@ key NULL key_len NULL ref NULL rows 2 +filtered 100.00 Extra id 1 select_type PRIMARY @@ -324,6 +329,7 @@ key PRIMARY key_len 4 ref t2.a rows 1 +filtered 100.00 Extra Using where id 2 select_type DERIVED @@ -335,6 +341,7 @@ key NULL key_len NULL ref NULL rows NULL +filtered NULL Extra No tables used id 3 select_type UNION @@ -346,6 +353,7 @@ key NULL key_len NULL ref NULL rows NULL +filtered NULL Extra No tables used # Lock the record. select 1 from t1 natural join (select 3 as a, 2 as b union all diff --git a/mysql-test/suite/innodb/r/innodb_stats_persistent.result b/mysql-test/suite/innodb/r/innodb_stats_persistent.result index 7386eb6c54d..c99bb2dfecd 100644 --- a/mysql-test/suite/innodb/r/innodb_stats_persistent.result +++ b/mysql-test/suite/innodb/r/innodb_stats_persistent.result @@ -22,8 +22,8 @@ connection default; # With innodb_stats_include_delete_marked=ON, # DELETE must not affect statistics before COMMIT. EXPLAIN SELECT * FROM t1 WHERE val=4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref val val 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref val val 4 const 1 100.00 Using index connection con1; COUNT(*) 0 @@ -32,8 +32,8 @@ SELECT COUNT(*) FROM t1; COUNT(*) 16 EXPLAIN SELECT * FROM t1 WHERE val=4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref val val 4 const 16 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref val val 4 const 16 100.00 Using index BEGIN; DELETE FROM t1; COMMIT; @@ -45,8 +45,8 @@ BEGIN; INSERT INTO t2 (val) SELECT 4 FROM seq_1_to_16; # The INSERT will show up before COMMIT. EXPLAIN SELECT * FROM t2 WHERE val=4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref val val 4 const 16 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref val val 4 const 16 100.00 Using index SELECT COUNT(*) FROM t2; COUNT(*) 16 @@ -57,29 +57,29 @@ COUNT(*) 0 connection con1; EXPLAIN SELECT * FROM t2 WHERE val=4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref val val 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref val val 4 const 1 100.00 Using index InnoDB 0 transactions not purged # After COMMIT and purge, the DELETE must show up. EXPLAIN SELECT * FROM t1 WHERE val=4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref val val 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref val val 4 const 1 100.00 Using index SET GLOBAL innodb_stats_include_delete_marked = OFF; BEGIN; INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; EXPLAIN SELECT * FROM t1 WHERE val=4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref val val 4 const 16 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref val val 4 const 16 100.00 Using index ROLLBACK; EXPLAIN SELECT * FROM t1 WHERE val=4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref val val 4 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref val val 4 const 1 100.00 Using index BEGIN; INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16; COMMIT; EXPLAIN SELECT * FROM t1 WHERE val=4; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref val val 4 const 16 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref val val 4 const 16 100.00 Using index BEGIN; DELETE FROM t1; SELECT COUNT(*) FROM t1; @@ -90,12 +90,12 @@ COUNT(*) # However, if there was a WHERE condition, # ha_innobase::records_in_range() would count the delete-marked records. EXPLAIN SELECT * FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL val 4 NULL 16 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL val 4 NULL 16 100.00 Using index ROLLBACK; EXPLAIN SELECT * FROM t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL val 4 NULL 16 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL val 4 NULL 16 100.00 Using index SELECT COUNT(*) FROM t1; COUNT(*) 16 diff --git a/mysql-test/suite/innodb/r/partition_locking.result b/mysql-test/suite/innodb/r/partition_locking.result index d2d53057f5a..711a835d998 100644 --- a/mysql-test/suite/innodb/r/partition_locking.result +++ b/mysql-test/suite/innodb/r/partition_locking.result @@ -196,8 +196,8 @@ d a b c 9 03 07 343 explain SELECT d,a,b,c FROM t3 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL index NULL PRIMARY 257 NULL 14 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index NULL PRIMARY 257 NULL 14 100.00 # # UPDATE ... SELECT * FROM t1 FOR UPDATE; @@ -390,8 +390,8 @@ d a b c 9 03 07 343 explain SELECT d,a,b,c FROM t3 ORDER BY d LOCK IN SHARE MODE SKIP LOCKED; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL index NULL PRIMARY 257 NULL 14 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index NULL PRIMARY 257 NULL 14 100.00 # # UPDATE ... SELECT * FROM t1 FOR UPDATE; diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result index bd7b2df20aa..2addc2f1a1c 100644 --- a/mysql-test/suite/innodb/r/temporary_table.result +++ b/mysql-test/suite/innodb/r/temporary_table.result @@ -23,24 +23,24 @@ i f c 97 1.4 delhi 96 1.5 ahmedabad explain select * from t1 where f > 1.29999; -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 +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 alter table t1 add index sec_index(f); explain select * from t1 where f > 1.29999; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range sec_index sec_index 5 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range sec_index sec_index 5 NULL 3 100.00 Using index condition select * from t1 where f > 1.29999; i f c 98 1.3 jaipur 97 1.4 delhi 96 1.5 ahmedabad explain select * from t1 where i = 100; -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 +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 alter table t1 add unique index pri_index(i); explain select * from t1 where i = 100; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const pri_index pri_index 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const pri_index pri_index 5 const 1 100.00 select * from t1 where i = 100; i f c 100 1.1 pune diff --git a/mysql-test/suite/innodb/r/temporary_table_optimization.result b/mysql-test/suite/innodb/r/temporary_table_optimization.result index 00c4e1d616b..7b105655e3e 100644 --- a/mysql-test/suite/innodb/r/temporary_table_optimization.result +++ b/mysql-test/suite/innodb/r/temporary_table_optimization.result @@ -114,12 +114,12 @@ drop procedure populate_t1; create temporary table t1 (t1_i int, t1_f float) engine = innodb; insert into t1 values (1, 1.1), (2, 2.5), (3, 2.5), (4, 4.4); explain select * from t1 where t1_i = 1; -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 +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 alter table t1 add unique index pri_index(t1_i); explain select * from t1 where t1_i = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const pri_index pri_index 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const pri_index pri_index 5 const 1 100.00 select * from t1 where t1_i = 1; t1_i t1_f 1 1.1 @@ -127,8 +127,8 @@ alter table t1 add unique index sec_index(t1_f); ERROR 23000: Duplicate entry '2.5' for key 'sec_index' alter table t1 add index sec_index(t1_f); explain select * from t1 where t1_f >= 2.5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range sec_index sec_index 5 NULL 3 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range sec_index sec_index 5 NULL 3 100.00 Using index condition select * from t1 where t1_f >= 2.5; t1_i t1_f 2 2.5 diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test index 86d9cfdb2b4..dd54d0554af 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online.test +++ b/mysql-test/suite/innodb/t/innodb-table-online.test @@ -166,7 +166,7 @@ INSERT INTO t1 SELECT 10 + c1, c2, c3 FROM t1; INSERT INTO t1 SELECT 20 + c1, c2, c3 FROM t1; INSERT INTO t1 SELECT 40 + c1, c2, c3 FROM t1; # Purge may or may not have cleaned up the DELETE FROM t1 WHERE c1 = 7; ---replace_column 9 ROWS +--replace_column 10 ROWS EXPLAIN SELECT COUNT(*) FROM t1 WHERE c2 > 3; ANALYZE TABLE t1; diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result index c26f7ee96f2..dc8500ea394 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext.result +++ b/mysql-test/suite/innodb_fts/r/fulltext.result @@ -58,35 +58,35 @@ Full-text search in MySQL implements vector space model 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL fulltext a a 0 1 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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0; -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 +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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1; -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 +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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0; -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 +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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1; -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 +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 explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections"); -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 +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 explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections"); -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 +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 explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections"); -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 +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 explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections"); -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 +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 explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%'; -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 +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 select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE); a b MySQL has now support for full-text search @@ -464,16 +464,16 @@ INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1), ANALYZE TABLE t1; EXPLAIN SELECT * FROM t1 WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL fulltext b,a a 0 1 62.50 Using where EXPLAIN SELECT * FROM t1 USE INDEX(a) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL fulltext a a 0 1 62.50 Using where EXPLAIN SELECT * FROM t1 FORCE INDEX(a) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL fulltext a a 0 1 62.50 Using where EXPLAIN SELECT * FROM t1 IGNORE INDEX(a) WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; ERROR HY000: Can't find FULLTEXT index matching the column list @@ -544,10 +544,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 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 +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 fulltext b2 b2 0 1 100.00 Using where +2 MATERIALIZED t3 NULL ALL NULL NULL NULL NULL 2 100.00 Using where # should return 0 SELECT count(*) FROM t1 WHERE not exists( @@ -649,8 +649,8 @@ ERROR HY000: Can't find FULLTEXT index matching the column list SELECT MATCH(a) AGAINST ('*') FROM z; ERROR HY000: Can't find FULLTEXT index matching the column list EXPLAIN SELECT MATCH(b) AGAINST ('*') FROM q; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE q NULL ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE q NULL ALL NULL NULL NULL NULL 1 100.00 SELECT MATCH(b) AGAINST ('*') FROM q; ERROR 42000: syntax error, unexpected $end, expecting FTS_TERM or FTS_NUMB or '*' DROP TABLE z, q; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_misc.result b/mysql-test/suite/innodb_fts/r/fulltext_misc.result index c0095c0d24a..66934234c52 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext_misc.result +++ b/mysql-test/suite/innodb_fts/r/fulltext_misc.result @@ -7,25 +7,25 @@ INSERT INTO t1 VALUES ('test'); EXPLAIN SELECT 1 FROM t1 WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST ("")) WHERE t1.f1 GROUP BY t1.f1)); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 Using index -2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where -2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 100.00 Using index +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 Using where +2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 100.00 Using index PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 WHERE 1 > ALL((SELECT 1 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 partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 Using index -2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where -2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 100.00 Using index +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 Using where +2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 100.00 Using index EXECUTE stmt; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 Using index -2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where -2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 100.00 Using index +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 Using where +2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 100.00 Using index DEALLOCATE PREPARE stmt; PREPARE stmt FROM 'EXPLAIN SELECT 1 FROM t1 @@ -33,15 +33,15 @@ PREPARE stmt FROM ON (MATCH(t1.f1) AGAINST ("")) WHERE t1.f1 GROUP BY t1.f1))'; EXECUTE stmt; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 Using index -2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where -2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 100.00 Using index +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 Using where +2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 100.00 Using index EXECUTE stmt; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 Using index -2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 Using where -2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL index NULL f1_2 8 NULL 1 100.00 Using index +2 SUBQUERY t1 NULL fulltext f1_2,f1 f1 0 1 100.00 Using where +2 SUBQUERY a NULL index NULL f1_2 8 NULL 1 100.00 Using index DEALLOCATE PREPARE stmt; DROP TABLE t1; drop table if exists t1; diff --git a/mysql-test/suite/innodb_fts/r/fulltext_order_by.result b/mysql-test/suite/innodb_fts/r/fulltext_order_by.result index f9f6bd3ffb8..ac6199efa2d 100644 --- a/mysql-test/suite/innodb_fts/r/fulltext_order_by.result +++ b/mysql-test/suite/innodb_fts/r/fulltext_order_by.result @@ -66,8 +66,8 @@ if(a in (4,7),2,1) rel alter table t1 add key m (message); ANALYZE TABLE t1; explain SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL fulltext message message 0 1 100.00 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/suite/innodb_gis/r/0.result b/mysql-test/suite/innodb_gis/r/0.result index 90f3db501dc..d67998a5516 100644 --- a/mysql-test/suite/innodb_gis/r/0.result +++ b/mysql-test/suite/innodb_gis/r/0.result @@ -555,8 +555,8 @@ COUNT(*) 1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref p p 28 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref p p 28 const 1 100.00 Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 @@ -564,22 +564,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref p p 28 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref p p 28 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 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 SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result index 5461dc2691e..619559b78c4 100644 --- a/mysql-test/suite/innodb_gis/r/1.result +++ b/mysql-test/suite/innodb_gis/r/1.result @@ -942,8 +942,8 @@ COUNT(*) 1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref p p 28 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref p p 28 const 1 100.00 Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 @@ -951,22 +951,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref p p 28 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref p p 28 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 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 SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 diff --git a/mysql-test/suite/innodb_gis/r/bug17057168.result b/mysql-test/suite/innodb_gis/r/bug17057168.result index 1aaf53afea7..da046de7474 100644 --- a/mysql-test/suite/innodb_gis/r/bug17057168.result +++ b/mysql-test/suite/innodb_gis/r/bug17057168.result @@ -12,8 +12,8 @@ INSERT INTO t1 (location) SELECT POINT(tmp1.id, tmp2.id) FROM tmp tmp1, tmp tmp2 ORDER BY tmp1.id, tmp2.id; EXPLAIN SELECT id, ST_AsText(location) FROM t1 WHERE location = POINT(1, 2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref location location 28 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref location location 28 const 1 100.00 Using where SELECT id, ST_AsText(location) FROM t1 WHERE location = POINT(1, 2); id ST_AsText(location) 163 POINT(1 2) diff --git a/mysql-test/suite/innodb_gis/r/create_spatial_index.result b/mysql-test/suite/innodb_gis/r/create_spatial_index.result index 2e10a7c4178..2a0039c596b 100644 --- a/mysql-test/suite/innodb_gis/r/create_spatial_index.result +++ b/mysql-test/suite/innodb_gis/r/create_spatial_index.result @@ -59,78 +59,78 @@ test.tab analyze status Engine-independent statistics collected test.tab analyze status OK SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_CRosses(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 90.00 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -144,29 +144,29 @@ c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -174,114 +174,114 @@ c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 80.00 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 90.00 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -295,29 +295,29 @@ c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -325,54 +325,54 @@ c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRTouches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where CREATE PROCEDURE proc_wl6968() BEGIN SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); @@ -382,12 +382,12 @@ WHERE MBRContains(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); END | CALL proc_wl6968(); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 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 tab NULL range idx3 idx3 34 NULL 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) @@ -488,78 +488,78 @@ test.tab analyze status Engine-independent statistics collected test.tab analyze status OK SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_CRosses(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 90.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -573,29 +573,29 @@ c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -603,114 +603,114 @@ c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 80.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 90.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -724,29 +724,29 @@ c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -754,54 +754,54 @@ c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRTouches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where CREATE PROCEDURE proc_wl6968() BEGIN SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); @@ -811,12 +811,12 @@ WHERE MBREquals(tab.c4, @g1); EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); END | CALL proc_wl6968(); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 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 tab NULL range idx3 idx3 34 NULL 1 100.00 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) @@ -906,78 +906,78 @@ test.tab analyze status Engine-independent statistics collected test.tab analyze status OK SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 300 300,400 400)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((100 200,200 300,400 500,500 300,300 200,100 300,100 200))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 10 10,30 30,40 40)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_CRosses(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Crosses(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Crosses(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 90.00 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -991,29 +991,29 @@ c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -1021,114 +1021,114 @@ c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING(7 1,30 30,1010 3010,1010 2010,3010 3010,4010 4010,5010 5010 )'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 80.00 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 100 100,200 200,300 300)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE ST_Touches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 4 POLYGON((300 300,400 400,500 500,300 500,300 400,300 300)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE ST_Touches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((7 1,6 2,6 3,10 3,10 1,7 1))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRContains(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRContains(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) '); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRWithin(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRWithin(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((4 -2,5 -4,6 -5,7 -4,7 2,4 -2))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 90.00 Using where SELECT c1,ST_Astext(c4) FROM tab WHERE MBRDisjoint(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -1142,29 +1142,29 @@ c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL index idx3 PRIMARY 4 NULL 10 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRDisjoint(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ALL idx3 NULL NULL NULL 10 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 10 POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBREquals(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) @@ -1172,54 +1172,54 @@ c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('LINESTRING( 30 30,40 40,50 50)'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRIntersects(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 1 POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRintersects(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 2,4 5,5 5,7 1,0 0 ))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBROverlaps(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 3 POLYGON((7 1,6 2,6 3,10 3,10 1,7 1)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBROverlaps(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 1 100.00 Using where SET @g1 = ST_GeomFromText( 'POLYGON((0 0,0 30,30 40,40 50,50 30,0 0))'); EXPLAIN SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where; Using filesort SELECT c1,ST_Astext(c4) FROM tab WHERE MBRTouches(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) 2 POLYGON((40 50,40 70,50 100,70 100,80 80,70 50,40 50)) EXPLAIN UPDATE tab SET C2 = ST_GeomFromText('POINT(0 0)') WHERE MBRTouches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where EXPLAIN DELETE FROM tab WHERE MBRTouches(tab.c4, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx3 idx3 34 NULL 2 100.00 Using where SET @g1 = ST_GeomFromText('POLYGON((5010 5010,5020 5020,5030 5030,5040 5030,5020 5010,5010 5010))'); SELECT c1,ST_Astext(c4) FROM tab WHERE MBREquals(tab.c4, @g1) ORDER BY c1; c1 ST_Astext(c4) diff --git a/mysql-test/suite/innodb_gis/r/geometry.result b/mysql-test/suite/innodb_gis/r/geometry.result index b4864f2016c..c79f7b8da80 100644 --- a/mysql-test/suite/innodb_gis/r/geometry.result +++ b/mysql-test/suite/innodb_gis/r/geometry.result @@ -180,40 +180,40 @@ CREATE UNIQUE INDEX idx2 on tab(c8(5) ASC) ; #check equality predicate on the index columns EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ref idx1 idx1 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ref idx1 idx1 8 const # 100.00 Using where #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ref idx1 idx1 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ref idx1 idx1 8 const # 100.00 Using where #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ref idx3 idx3 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ref idx3 idx3 8 const # 100.00 Using where #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL ref idx3 idx3 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL ref idx3 idx3 8 const # 100.00 Using where #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL const idx2 idx2 8 const # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL const idx2 idx2 8 const # 100.00 #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL const idx2 idx2 8 const # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL const idx2 idx2 8 const # 100.00 #check index with DELETE operation EXPLAIN DELETE FROM tab WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab NULL range idx2 idx2 8 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab NULL range idx2 idx2 8 NULL # 100.00 Using where #check the spatial values SELECT ST_AsText(c1) FROM tab; ST_AsText(c1) @@ -704,40 +704,40 @@ CREATE UNIQUE INDEX idx2 on tab3(c8(5) ASC) ; #check equality predicate on the index columns EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c2=ST_LineFromText('LINESTRING(10 10,20 20,30 30)'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab3 NULL ref idx1 idx1 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab3 NULL ref idx1 idx1 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab3 NULL ref idx3 idx3 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c3=ST_PolyFromWKB(ST_AsWkB(ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'))); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab3 NULL ref idx3 idx3 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c8=ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab3 NULL const idx2 idx2 8 const # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab3 NULL const idx2 idx2 8 const # 100.00 #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab3 NULL const idx2 idx2 8 const # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab3 NULL const idx2 idx2 8 const # 100.00 #check index with DELETE operation EXPLAIN DELETE FROM tab3 WHERE c8=ST_GeometryFromWKB(ST_AsWKB(ST_GeomCollFromText('GeometryCollection(Point(1 1),LineString(2 2, 3 3))'))); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab3 NULL range idx2 idx2 8 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab3 NULL range idx2 idx2 8 NULL # 100.00 Using where #check the spatial values SELECT ST_AsText(c1) FROM tab3; ST_AsText(c1) @@ -784,13 +784,13 @@ tab3 CREATE TABLE `tab3` ( #check index with WKB function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c2=ST_LineStringFromWKB(ST_AsWKB(ST_LineFromText('LINESTRING(10 10,20 20,30 30)'))); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab3 NULL ref idx1 idx1 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab3 NULL ref idx1 idx1 8 const # 100.00 Using where #check index with WKT function EXPLAIN SELECT ST_ASText(c1),ST_AsText(c2),ST_AsText(c8) FROM tab3 WHERE c3=ST_PolyFromText('POLYGON((0 0,5 5,10 10,15 15,0 0),(10 10,20 20,30 30,40 40,10 10))'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tab3 NULL ref idx3 idx3 8 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tab3 NULL ref idx3 idx3 8 const # 100.00 Using where #check the Geometry property functions SELECT fid, ST_Dimension(g) FROM gis_geometry; fid ST_Dimension(g) diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result index a73836e8960..11eaac7ab84 100644 --- a/mysql-test/suite/innodb_gis/r/gis.result +++ b/mysql-test/suite/innodb_gis/r/gis.result @@ -939,8 +939,8 @@ COUNT(*) 1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref p p 28 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref p p 28 const 1 100.00 Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 @@ -948,22 +948,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 Using where +id select_type 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 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref p p 28 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref p p 28 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 2 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 SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 diff --git a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result index f2ed437d860..a44f03421fc 100644 --- a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result +++ b/mysql-test/suite/innodb_gis/r/innodb_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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 8 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range g g 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range g g 34 NULL 4 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(a,Point(1,2)); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE MBRINTERSECTS(Point(1,2),a); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE ST_INTERSECTS(Point(1,2),a); -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 34 NULL 1 100.00 Using where DROP TABLE t1; # # MDEV-8610 "WHERE CONTAINS(indexed_geometry_column,1)" causes full table scan diff --git a/mysql-test/suite/innodb_gis/r/point_basic.result b/mysql-test/suite/innodb_gis/r/point_basic.result index 33861cbdc28..1d0eebed073 100644 --- a/mysql-test/suite/innodb_gis/r/point_basic.result +++ b/mysql-test/suite/innodb_gis/r/point_basic.result @@ -24,8 +24,8 @@ INSERT INTO gis_point VALUES (ST_PointFromText('POINT(100.32374832 101.23741821)'), ST_PointFromText('POINT(200.32247328 101.86728201)')), (ST_PointFromText('POINT(100.32374832 101.23741821)'), ST_PointFromText('POINT(100.32374832 101.98527111)')); EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point GROUP BY p1, p2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL # Using temporary; Using filesort +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 # 100.00 Using temporary; Using filesort SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point GROUP BY p1, p2; ST_AsText(p1) ST_AsText(p2) POINT(100.32374832 101.23741821) POINT(100.32374832 101.98527111) @@ -301,8 +301,8 @@ INSERT INTO gis_point VALUES (206, ST_PointFromWKB(ST_AsWKB(ST_PointFromText('POINT(103.43718640 105.248206478)')))); 'The ORDER BY will use filesort' EXPLAIN SELECT ST_AsText(p) FROM gis_point ORDER BY p; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL # Using filesort +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 # 100.00 Using filesort SELECT ST_AsText(p) FROM gis_point ORDER BY p; ST_AsText(p) POINT(10 10) @@ -1325,8 +1325,8 @@ Table Op Msg_type Msg_text test.gis_point check status OK The ORDER BY for spatial index will use filesort EXPLAIN SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE gis_point NULL ALL NULL NULL NULL NULL # Using filesort +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 # 100.00 Using filesort SELECT ST_AsText(p1), ST_AsText(p2) FROM gis_point ORDER BY p1, p2; ST_AsText(p1) ST_AsText(p2) POINT(2 4) POINT(-2 -6) @@ -1487,8 +1487,8 @@ a ST_AsText(p) ST_AsText(l) ST_AsText(g) 1 POINT(10 10) LINESTRING(1 1,5 5,10 10) POLYGON((30 30,40 40,50 50,30 50,30 40,30 30)) 2 POINT(20 20) LINESTRING(2 3,7 8,9 10,15 16) POLYGON((10 30,30 40,40 50,40 30,30 20,10 30)) EXPLAIN UPDATE t1 SET p = ST_GeomFromText('POINT(30 30)') WHERE p = ST_GeomFromText('POINT(20 20)'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 27 NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range PRIMARY PRIMARY 27 NULL # 100.00 Using where UPDATE t1 SET p = ST_GeomFromText('POINT(30 30)') WHERE p = ST_GeomFromText('POINT(20 20)'); SELECT a, ST_AsText(p), ST_AsText(l), ST_AsText(g) FROM t1; a ST_AsText(p) ST_AsText(l) ST_AsText(g) @@ -1525,8 +1525,8 @@ a ST_AsText(p) ST_AsText(l) ST_AsText(g) ALTER TABLE t1 DROP PRIMARY KEY; ALTER TABLE t1 ADD PRIMARY KEY(p); EXPLAIN SELECT a, ST_AsText(p) FROM t1 WHERE a = 2 AND p = ST_GeomFromText('POINT(30 30)'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL const PRIMARY,idx2 PRIMARY 27 const # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL const PRIMARY,idx2 PRIMARY 27 const # 100.00 SELECT a, ST_AsText(p) FROM t1 WHERE a = 2 AND p = ST_GeomFromText('POINT(30 30)'); a ST_AsText(p) 2 POINT(30 30) diff --git a/mysql-test/suite/innodb_gis/r/rt_precise.result b/mysql-test/suite/innodb_gis/r/rt_precise.result index 432f3efe69c..8baf1178207 100644 --- a/mysql-test/suite/innodb_gis/r/rt_precise.result +++ b/mysql-test/suite/innodb_gis/r/rt_precise.result @@ -21,8 +21,8 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 140))')); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL gis_key NULL NULL NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL gis_key NULL NULL NULL # 100.00 Using where SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')) ORDER BY fid; fid ST_AsText(g) 1 LINESTRING(150 150,150 150) diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result index 93d196932d3..71bf01b72ad 100644 --- a/mysql-test/suite/innodb_gis/r/rtree.result +++ b/mysql-test/suite/innodb_gis/r/rtree.result @@ -10,8 +10,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 100.00 Using where select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); ST_astext(t1.g) POINT(1 1) @@ -156,8 +156,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 100.00 Using where select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); ST_astext(t1.g) POINT(1 1) diff --git a/mysql-test/suite/innodb_gis/r/rtree_estimate.result b/mysql-test/suite/innodb_gis/r/rtree_estimate.result index 7fc034664ea..7df6ef68bb6 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_estimate.result +++ b/mysql-test/suite/innodb_gis/r/rtree_estimate.result @@ -6,8 +6,8 @@ SET @g1 = ST_GeomFromText('POINT(10 10)'); SET @g2 = ST_GeomFromText('POLYGON((5 5, 20 5, 20 21, 5 21, 5 5))'); SET @g3 = ST_GeomFromText('POLYGON((1.79769e+308 1.79769e+308, 20 5, -1.79769e+308 -1.79769e+308, 1.79769e+308 1.79769e+308))'); EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRContains(g, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL g NULL NULL NULL 1 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g1); ST_AsText(g) INSERT INTO t1 VALUES(@g1); @@ -23,105 +23,105 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRContains(g, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 1 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g1); ST_AsText(g) POINT(10 10) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRDisjoint(g, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 2 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g1); ST_AsText(g) POINT(10 10) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBREquals(g, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 1 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g1); ST_AsText(g) POINT(10 10) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRIntersects(g, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 1 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g1); ST_AsText(g) POINT(10 10) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 1 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g1); ST_AsText(g) POINT(10 10) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRContains(g, @g2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 1 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g2); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRDisjoint(g, @g2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 1 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g2); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBREquals(g, @g2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 1 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g2); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRIntersects(g, @g2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 2 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g2); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 2 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g2); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRContains(g, @g3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g3); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) POLYGON((1.79769e308 1.79769e308,20 5,-1.79769e308 -1.79769e308,1.79769e308 1.79769e308)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRDisjoint(g, @g3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g3); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) POLYGON((1.79769e308 1.79769e308,20 5,-1.79769e308 -1.79769e308,1.79769e308 1.79769e308)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBREquals(g, @g3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g3); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) POLYGON((1.79769e308 1.79769e308,20 5,-1.79769e308 -1.79769e308,1.79769e308 1.79769e308)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRIntersects(g, @g3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g3); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) POLYGON((1.79769e308 1.79769e308,20 5,-1.79769e308 -1.79769e308,1.79769e308 1.79769e308)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL g NULL NULL NULL 3 100.00 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g3); ST_AsText(g) POINT(10 10) diff --git a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result index 5bbd15fb500..0cbcf5d35eb 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result +++ b/mysql-test/suite/innodb_gis/r/rtree_multi_pk.result @@ -10,8 +10,8 @@ test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK set @g1 = ST_GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0))'); explain select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL g NULL NULL NULL 5 100.00 Using where select ST_astext(t1.g) from t1 where MBRWithin(t1.g, @g1); ST_astext(t1.g) POINT(1 1) diff --git a/mysql-test/suite/innodb_gis/r/types.result b/mysql-test/suite/innodb_gis/r/types.result index 55f74f1c66b..7b09d96883e 100644 --- a/mysql-test/suite/innodb_gis/r/types.result +++ b/mysql-test/suite/innodb_gis/r/types.result @@ -32,8 +32,8 @@ MULTIPOLYGON(((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))) GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(2 2,3 3)) CREATE INDEX i_p ON t_wl6455 (g(10)); EXPLAIN SELECT ST_AsText(g) FROM t_wl6455 WHERE g = POINT(2,2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t_wl6455 NULL ref i_p i_p 12 const # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t_wl6455 NULL ref i_p i_p 12 const # 100.00 Using where SELECT ST_AsText(g) FROM t_wl6455 WHERE g = POINT(2,2); ST_AsText(g) POINT(2 2) diff --git a/mysql-test/suite/innodb_zip/r/index_large_prefix.result b/mysql-test/suite/innodb_zip/r/index_large_prefix.result index 26dbbdc4718..84d5e642bc9 100644 --- a/mysql-test/suite/innodb_zip/r/index_large_prefix.result +++ b/mysql-test/suite/innodb_zip/r/index_large_prefix.result @@ -47,8 +47,8 @@ select @@session.tx_isolation; @@session.tx_isolation REPEATABLE-READ explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743 NULL ref idx idx 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE worklog5743 NULL ref idx idx 5 const 1 100.00 select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; a1 a2 = repeat("a", 10000) 9 1 @@ -73,8 +73,8 @@ select @@session.tx_isolation; @@session.tx_isolation REPEATABLE-READ explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743 NULL ref idx idx 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE worklog5743 NULL ref idx idx 5 const 1 100.00 select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9; a1 a2 = repeat("a", 10000) 9 1 @@ -263,20 +263,20 @@ select @@session.tx_isolation; @@session.tx_isolation REPEATABLE-READ explain select a1, left(a2, 20) from worklog5743_1 where a1 = 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_1 NULL ref idx6 idx6 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE worklog5743_1 NULL ref idx6 idx6 5 const 1 100.00 explain select a1, left(a2, 20) from worklog5743_2 where a1 = 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_2 NULL ref idx6 idx6 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE worklog5743_2 NULL ref idx6 idx6 5 const 1 100.00 explain select a1, left(a2, 20) from worklog5743_4 where a1 = 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_4 NULL ref idx6 idx6 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE worklog5743_4 NULL ref idx6 idx6 5 const 1 100.00 explain select a1, left(a2, 20) from worklog5743_8 where a1 = 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_8 NULL ref idx5,idx7 idx5 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE worklog5743_8 NULL ref idx5,idx7 idx5 5 const 1 100.00 explain select a1, left(a2, 20) from worklog5743_16 where a1 = 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743_16 NULL ref idx5,idx7 idx5 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE worklog5743_16 NULL ref idx5,idx7 idx5 5 const 1 100.00 select a1, left(a2, 20) from worklog5743_1 where a1 = 9; a1 left(a2, 20) 9 aaaaaaaaaaaaaaaaaaaa @@ -372,8 +372,8 @@ select @@session.tx_isolation; @@session.tx_isolation REPEATABLE-READ explain select a1 from worklog5743 where a1 = 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE worklog5743 NULL ref idx6 idx6 5 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE worklog5743 NULL ref idx6 idx6 5 const 1 100.00 Using index select a1 from worklog5743 where a1 = 9; a1 9 diff --git a/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff b/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff index 6848c66b5f6..69f8701168b 100644 --- a/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff +++ b/mysql-test/suite/innodb_zip/r/page_size,4k.rdiff @@ -344,8 +344,8 @@ -Table Op Msg_type Msg_text -test.t1 check status OK -EXPLAIN SELECT * FROM t1 WHERE b LIKE 'adfd%'; --id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE t1 range b b 769 NULL # Using where +-id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE t1 NULL range b b 769 # 12 100.00 Using where -DROP TABLE t1; # Test 8) Test creating a table that could lead to undo log overflow. CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, diff --git a/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff b/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff index f71d5f9b37e..8a7558edbd7 100644 --- a/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff +++ b/mysql-test/suite/innodb_zip/r/page_size,8k.rdiff @@ -314,8 +314,8 @@ -Table Op Msg_type Msg_text -test.t1 check status OK -EXPLAIN SELECT * FROM t1 WHERE b LIKE 'adfd%'; --id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE t1 range b b 769 NULL # Using where +-id select_type table partitions type possible_keys key key_len ref rows filtered Extra +-1 SIMPLE t1 NULL range b b 769 # 12 100.00 Using where -DROP TABLE t1; # Test 8) Test creating a table that could lead to undo log overflow. CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, diff --git a/mysql-test/suite/innodb_zip/r/page_size.result b/mysql-test/suite/innodb_zip/r/page_size.result index c99db2ba773..ce8ea1ecdf9 100644 --- a/mysql-test/suite/innodb_zip/r/page_size.result +++ b/mysql-test/suite/innodb_zip/r/page_size.result @@ -372,8 +372,8 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK EXPLAIN SELECT * FROM t1 WHERE b LIKE 'adfd%'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range b b 769 # 12 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 769 # 12 100.00 Using where DROP TABLE t1; # Test 8) Test creating a table that could lead to undo log overflow. CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, diff --git a/mysql-test/suite/json/r/json_no_table.result b/mysql-test/suite/json/r/json_no_table.result index bcbc38ac616..0a8366e3a1d 100644 --- a/mysql-test/suite/json/r/json_no_table.result +++ b/mysql-test/suite/json/r/json_no_table.result @@ -3175,8 +3175,8 @@ Warning 4038 Syntax error in JSON text in argument 1 to function 'json_extract' # Crash in Item_copy_json::~Item_copy_json # ---------------------------------------------------------------------- EXPLAIN SELECT COUNT(*), JSON_KEYS('{}'); -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 +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 select json_search( '{ "a": "foo" }', 'one', 'foo', 'a' ); json_search( '{ "a": "foo" }', 'one', 'foo', 'a' ) "$.a" diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index 580098f3b1b..c9e2aca8c45 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -226,8 +226,8 @@ EXPLAIN } explain select * from json_table('[{"a": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}]', '$[*]' COLUMNS( a INT PATH '$.a')) as tt; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tt NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table create view v1 as select * from json_table('[{"color": "blue", "price": 50}]', '$[*]' columns(color text path '$.nonexistent', @@ -380,10 +380,10 @@ insert into t2 select '[1,2,3]',A.a from t1 A, t1 B; explain select * from t1, (select * from t2, json_table(t2.js, '$[*]' columns (o for ordinality)) as jt) as TT2 where 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 -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 100 Using join buffer (flat, BNL join) -1 SIMPLE jt NULL ALL NULL NULL NULL NULL 40 Table function: json_table +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 100 100.00 Using join buffer (flat, BNL join) +1 SIMPLE jt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table drop table t1, t2; CREATE TABLE t1 (x INT); INSERT INTO t1 VALUES (1); @@ -403,10 +403,10 @@ insert into t21 values (1, '{"a":100}'); explain select t20.a, jt1.ab from t20 left join t21 on t20.a=t21.a join JSON_TABLE(t21.js,'$' COLUMNS (ab INT PATH '$.a')) AS jt1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t20 NULL ALL NULL NULL NULL NULL 2 -1 SIMPLE t21 NULL eq_ref PRIMARY PRIMARY 4 test.t20.a 1 -1 SIMPLE jt1 NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t20 NULL ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t21 NULL eq_ref PRIMARY PRIMARY 4 test.t20.a 1 100.00 +1 SIMPLE jt1 NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table drop table t20, t21; select * from json_table( @@ -475,12 +475,12 @@ t20 left join t21 on t20.a=t21.a join (t31 left join (t32 join JSON_TABLE(t21.js,'$' COLUMNS (ab INT PATH '$.a')) AS jt1) on t31.a<3); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t31 NULL system NULL NULL NULL NULL 1 -1 SIMPLE t20 NULL ALL NULL NULL NULL NULL 100 -1 SIMPLE t21 NULL eq_ref PRIMARY PRIMARY 4 test.t20.a 1 -1 SIMPLE t32 NULL ALL NULL NULL NULL NULL 1 Using where -1 SIMPLE jt1 NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t31 NULL system NULL NULL NULL NULL 1 100.00 +1 SIMPLE t20 NULL ALL NULL NULL NULL NULL 100 100.00 +1 SIMPLE t21 NULL eq_ref PRIMARY PRIMARY 4 test.t20.a 1 100.00 +1 SIMPLE t32 NULL ALL NULL NULL NULL NULL 1 100.00 Using where +1 SIMPLE jt1 NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table drop table t20,t21,t31,t32; # # MDEV-25142: JSON_TABLE: CREATE VIEW involving EXISTS PATH ends up with invalid frm @@ -636,8 +636,8 @@ t1 left join json_table(concat('',js), '$' columns ( color varchar(32) path '$.color') ) as JT on 1; -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 +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 explain select * from @@ -653,9 +653,9 @@ t1 left join json_table((select concat(a,js) from t2), '$' columns ( color varchar(32) path '$.color') ) as JT on 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 t2 NULL system NULL NULL NULL NULL 1 +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 t2 NULL system NULL NULL NULL NULL 1 100.00 explain select * from @@ -789,9 +789,9 @@ WHERE EXISTS(SELECT * FROM JSON_TABLE(b, '$' COLUMNS(o FOR ORDINALITY)) AS jt WHERE jt.o = t1.a); -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 jt NULL ALL NULL NULL NULL NULL 40 Table function: json_table; 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 2 100.00 +1 PRIMARY jt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table; Using where; FirstMatch(t1) drop table t1; # # MDEV-25381: JSON_TABLE: ER_WRONG_OUTER_JOIN upon query with LEFT and RIGHT joins and view diff --git a/mysql-test/suite/json/r/json_table_mysql.result b/mysql-test/suite/json/r/json_table_mysql.result index 7ab5f3a0ee9..e5f5e2cae3a 100644 --- a/mysql-test/suite/json/r/json_table_mysql.result +++ b/mysql-test/suite/json/r/json_table_mysql.result @@ -375,8 +375,8 @@ WHERE a=1; i a EXPLAIN SELECT * FROM jt, JSON_TABLE(jt.i, '$' COLUMNS (a INT PATH '$')) AS tt WHERE a=1; -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 +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 SELECT * FROM ( SELECT * FROM jt, JSON_TABLE(jt.i, '$' COLUMNS (a INT PATH '$')) AS tt WHERE a=1) AS ttt; @@ -384,8 +384,8 @@ i a EXPLAIN SELECT * FROM ( SELECT * FROM jt, JSON_TABLE(jt.i, '$' COLUMNS (a INT PATH '$')) AS tt WHERE a=1) AS ttt; -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 +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 DROP TABLE jt; CREATE VIEW v AS SELECT * FROM JSON_TABLE('[1,2,3]', @@ -480,9 +480,9 @@ EXPLAIN SELECT /*+ JOIN_ORDER(jt, t1) */ id, jt.* FROM t1, JSON_TABLE(jd, '$[*]' COLUMNS (jid FOR ORDINALITY, val INT PATH '$')) AS jt; -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 jt NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type 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 jt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table SELECT /*+ JOIN_ORDER(t2,jt) */ t1.id, t2.id, jt.* FROM t1, JSON_TABLE(t1.jd, '$[*]' COLUMNS (jid FOR ORDINALITY, @@ -506,19 +506,19 @@ FROM t1, JSON_TABLE(t1.jd, '$[*]' COLUMNS (jid FOR ORDINALITY, val INT PATH '$')) AS jt, t1 AS t2; -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 jt NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type 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 join buffer (flat, BNL join) +1 SIMPLE jt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table EXPLAIN SELECT /*+ JOIN_ORDER(t2,jt) */ t1.id, t2.id, jt.* FROM t1, JSON_TABLE(t1.jd, '$[*]' COLUMNS (jid FOR ORDINALITY, val INT PATH '$')) AS jt, t1 AS t2; -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 jt NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type 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 join buffer (flat, BNL join) +1 SIMPLE jt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table SELECT * FROM t1 WHERE id IN (SELECT * FROM JSON_TABLE('[1,2]', '$[*]' COLUMNS (id INT PATH '$')) AS jt); @@ -528,10 +528,10 @@ id jd EXPLAIN SELECT * FROM t1 WHERE id IN (SELECT * FROM JSON_TABLE('[1,2]', '$[*]' COLUMNS (id INT PATH '$')) AS jt); -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 jt NULL ALL NULL NULL NULL NULL 40 Table function: json_table +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 jt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table DROP TABLE t1; SELECT * FROM JSON_TABLE('"asdf"', '$' COLUMNS( tm TIME PATH '$', @@ -673,8 +673,8 @@ SELECT * FROM t1 LEFT JOIN JSON_TABLE(t1.jc, '$' COLUMNS id jc id EXPLAIN SELECT * FROM t1 LEFT JOIN JSON_TABLE(t1.jc, '$' COLUMNS (id FOR ORDINALITY)) as jt ON t1.jc=jt.id; -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 +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 SELECT * FROM t1 t1o RIGHT JOIN t1 ON t1o.id=t1.id LEFT JOIN JSON_TABLE(t1.jc, '$' COLUMNS (id FOR ORDINALITY)) as jt ON t1.jc=jt.id; @@ -682,8 +682,8 @@ id jc id jc id EXPLAIN SELECT * FROM t1 t1o RIGHT JOIN t1 ON t1o.id=t1.id LEFT JOIN JSON_TABLE(t1.jc, '$' COLUMNS (id FOR ORDINALITY)) as jt ON t1.jc=jt.id; -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 +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 SELECT * FROM t1 AS t1o RIGHT JOIN (t1 AS t1i JOIN JSON_TABLE(t1o.jc, '$' COLUMNS (id FOR ORDINALITY)) as jt ON t1i.jc=jt.id) @@ -729,9 +729,9 @@ id jc id 3 3 3 EXPLAIN SELECT * FROM t1 LEFT JOIN JSON_TABLE(t1.jc, '$' COLUMNS (id INT PATH '$')) as jt ON t1.id=jt.id; -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 jt NULL ALL NULL NULL NULL NULL 40 Table function: json_table; Using where +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 jt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table; Using where SELECT * FROM t1 LEFT JOIN JSON_TABLE(t1.jc, '$' COLUMNS (id FOR ORDINALITY)) as jt ON t1.jc=jt.id @@ -1006,29 +1006,29 @@ SELECT alias.* FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb BLOB PATH '$')) as a blb asd123 EXPLAIN SELECT alias.* FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb BLOB PATH '$')) as alias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table EXPLAIN SELECT alias.* FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb TINYBLOB PATH '$')) as alias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table EXPLAIN SELECT alias.* FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb MEDIUMBLOB PATH '$')) as alias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table EXPLAIN SELECT alias.* FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb LONGBLOB PATH '$')) as alias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table EXPLAIN SELECT alias.* FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb TEXT PATH '$')) as alias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table EXPLAIN SELECT alias.* FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb TINYTEXT PATH '$')) as alias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table EXPLAIN SELECT alias.* FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb MEDIUMTEXT PATH '$')) as alias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table EXPLAIN SELECT alias.* FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb LONGTEXT PATH '$')) as alias; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE alias NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table SELECT * FROM (SELECT CAST(blb AS JSON) jf FROM JSON_TABLE('"asd123"', '$' COLUMNS (blb BLOB PATH '$')) AS jti) AS dt, @@ -1050,16 +1050,16 @@ DROP TABLE t; # Bug#26583283: ASSERTION `!THD->IS_ERROR()' FAILED IN SQL_RESOLVER.CC # EXPLAIN SELECT * FROM JSON_TABLE('null', '$' COLUMNS(AA DECIMAL PATH '$')) tt; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE tt NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE tt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table CREATE VIEW v1 AS SELECT * FROM JSON_TABLE( 'null', '$' COLUMNS (c1 DECIMAL PATH '$' ) ) AS jt; SELECT * FROM v1; c1 NULL EXPLAIN SELECT * FROM v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE jt NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE jt NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table DROP VIEW v1; # # Bug#25822408: ASSERTION `!COL->CHILD_JDS->PRODUCING_RECORDS' FAILED @@ -1115,9 +1115,9 @@ EXPLAIN SELECT * FROM t1 WHERE col_varchar_key NOT IN ( SELECT col_varchar_key FROM JSON_TABLE( '[{"col_key": 1},{"col_key": 2}]', "$[*]" COLUMNS (col_varchar_key VARCHAR(10) PATH "$.col_key")) AS innr1); -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 innr1 NULL ALL NULL NULL NULL NULL 40 Table function: json_table; 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 innr1 NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table; Using where SELECT * FROM t1 WHERE col_varchar_key IN ( SELECT col_varchar_key FROM JSON_TABLE( '[{"col_key": 1},{"col_key": 2}]', "$[*]" COLUMNS @@ -1128,9 +1128,9 @@ EXPLAIN SELECT * FROM t1 WHERE col_varchar_key IN ( SELECT col_varchar_key FROM JSON_TABLE( '[{"col_key": 1},{"col_key": 2}]', "$[*]" COLUMNS (col_varchar_key VARCHAR(10) PATH "$.col_key")) AS innr1); -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 innr1 NULL ALL NULL NULL NULL NULL 40 Table function: json_table; 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 innr1 NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table; Using where; FirstMatch(t1); Using join buffer (flat, BNL join) DROP TABLE t1; # # Bug#26711551: WL8867:CONDITIONAL JUMP IN JSON_TABLE_COLUMN::CLEANUP @@ -1202,10 +1202,10 @@ id f1 id f1 EXPLAIN SELECT * FROM t1 as jj1, (SELECT tt2.* FROM t1 as tt2, JSON_TABLE(f1, "$" COLUMNS (id FOR ORDINALITY)) AS tbl) dt; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE jj1 NULL ALL NULL NULL NULL NULL 6 -1 SIMPLE tt2 NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) -1 SIMPLE tbl NULL ALL NULL NULL NULL NULL 40 Table function: json_table +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE jj1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 SIMPLE tt2 NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) +1 SIMPLE tbl NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table SELECT * FROM t1 as jj1, (SELECT tt2.* FROM t1 as tt2, JSON_TABLE(f1, "$" COLUMNS (id FOR ORDINALITY)) AS tbl STRAIGHT_JOIN @@ -1225,11 +1225,11 @@ EXPLAIN SELECT * FROM t1 as jj1, (SELECT tt2.* FROM t1 as tt2, JSON_TABLE(f1, "$" COLUMNS (id FOR ORDINALITY)) AS tbl STRAIGHT_JOIN t1 AS tt3) dt ORDER BY 1,3 LIMIT 11; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE jj1 NULL ALL NULL NULL NULL NULL 6 Using temporary; Using filesort -1 SIMPLE tt2 NULL ALL NULL NULL NULL NULL 6 Using join buffer (flat, BNL join) -1 SIMPLE tbl NULL ALL NULL NULL NULL NULL 40 Table function: json_table -1 SIMPLE tt3 NULL 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 filtered Extra +1 SIMPLE jj1 NULL ALL NULL NULL NULL NULL 6 100.00 Using temporary; Using filesort +1 SIMPLE tt2 NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) +1 SIMPLE tbl NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table +1 SIMPLE tt3 NULL ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) SELECT * FROM t1 WHERE id IN (SELECT id FROM t1 as tt2, JSON_TABLE(f1, "$" COLUMNS (jf FOR ORDINALITY)) AS tbl); @@ -1243,11 +1243,11 @@ id f1 EXPLAIN SELECT * FROM t1 WHERE id IN (SELECT id FROM t1 as tt2, JSON_TABLE(f1, "$" COLUMNS (jf FOR ORDINALITY)) AS tbl); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 6 -1 PRIMARY <subquery2> NULL eq_ref distinct_key distinct_key 4 func 1 -2 MATERIALIZED tt2 NULL ALL NULL NULL NULL NULL 6 -2 MATERIALIZED tbl NULL ALL NULL NULL NULL NULL 40 Table function: json_table +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 tt2 NULL ALL NULL NULL NULL NULL 6 100.00 +2 MATERIALIZED tbl NULL ALL NULL NULL NULL NULL 40 100.00 Table function: json_table DROP TABLE t1; # # Bug#26760811: WL#8867: MEMORY LEAK REPORTED BY ASAN AND VALGRIND diff --git a/mysql-test/suite/maria/collations.result b/mysql-test/suite/maria/collations.result index 0950747cac8..cdcdbfbc147 100644 --- a/mysql-test/suite/maria/collations.result +++ b/mysql-test/suite/maria/collations.result @@ -4,8 +4,8 @@ Note 1051 Unknown table 'test.t1' CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_croatian_ci, KEY(a)) ENGINE=ARIA; INSERT INTO t1 VALUES ('na'),('nj'),('nz'),('Z'); explain SELECT a FROM t1 ORDER BY a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 33 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 33 NULL 4 100.00 Using index SELECT a FROM t1 ORDER BY a; a na @@ -14,8 +14,8 @@ nj Z ALTER TABLE t1 engine=myisam; explain SELECT a FROM t1 ORDER BY a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL a 33 NULL 4 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL a 33 NULL 4 100.00 Using index SELECT a FROM t1 ORDER BY a; a na diff --git a/mysql-test/suite/maria/create.result b/mysql-test/suite/maria/create.result index 0743819a504..dcaed4213da 100644 --- a/mysql-test/suite/maria/create.result +++ b/mysql-test/suite/maria/create.result @@ -41,9 +41,9 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=Aria ROW_FORMAT=COMPRESSED; INSERT INTO t1 VALUES(1); CREATE TEMPORARY TABLE t2(b INT); EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT MAX(a) FROM t2); -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 index -2 DEPENDENT 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 Using index +2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away DROP TABLE t1,t2; SET SQL_MODE=''; CREATE TABLE t1 (c INT PRIMARY KEY) ENGINE=Aria; diff --git a/mysql-test/suite/maria/icp.result b/mysql-test/suite/maria/icp.result index d9001981760..7c0b9c701e0 100644 --- a/mysql-test/suite/maria/icp.result +++ b/mysql-test/suite/maria/icp.result @@ -166,8 +166,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY PRIMARY 4 NULL 4 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 4 100.00 Using where DROP TABLE t1; # @@ -203,8 +203,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c1 c1 8 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c1 c1 8 NULL 3 100.00 Using where SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w'; c1 c-1004=w @@ -212,14 +212,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c1 c1 12 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c1 c1 12 NULL 2 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL c1 NULL NULL NULL 100 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL c1 NULL NULL NULL 100 100.00 Using where SELECT c1 FROM t3 WHERE c1 >= 'c-1004=w' and c1 <= 'c-1006=w' or i1 > 2; c1 c-1004=w @@ -408,8 +408,8 @@ FROM t1 WHERE (pk BETWEEN 4 AND 5 OR pk < 2) AND c1 < 240 ORDER BY c1 LIMIT 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range PRIMARY,k1 PRIMARY 4 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 filtered Extra +1 SIMPLE t1 NULL range PRIMARY,k1 PRIMARY 4 NULL 3 50.00 Using index condition; Using where; Rowid-ordered scan; Using filesort DROP TABLE t1; # # @@ -429,10 +429,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 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) +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 NULL ALL NULL NULL NULL NULL # 100.00 Using where +2 DEPENDENT SUBQUERY it NULL eq_ref PRIMARY PRIMARY 4 func # 100.00 Using index condition +2 DEPENDENT SUBQUERY t2 NULL index NULL PRIMARY 4 NULL # 100.00 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 @@ -451,8 +451,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL 5 100.00 Using where SET SESSION optimizer_switch='index_condition_pushdown=off'; SELECT pk, c1 FROM t1 WHERE (pk<3 or pk>3); pk c1 @@ -506,9 +506,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 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) +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 index condition; Rowid-ordered scan +1 SIMPLE t2 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 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); @@ -599,9 +599,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 100.00 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 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 @@ -609,9 +609,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL k1 9 NULL 3 100.00 Using index +1 SIMPLE t2 NULL const PRIMARY PRIMARY 4 const 1 100.00 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 @@ -652,8 +652,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 13 NULL # 100.00 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; @@ -664,8 +664,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range b b 13 NULL # 100.00 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; @@ -686,9 +686,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # 100.00 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 @@ -697,9 +697,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL PRIMARY NULL NULL NULL # 100.00 Using where; Using filesort +1 SIMPLE t2 NULL ref a a 515 test.t1.a # 100.00 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 @@ -816,11 +816,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t NULL ALL PRIMARY,c NULL NULL NULL 64 100.00 Using where +1 PRIMARY t2 NULL ref g g 5 test.t.c 18 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL index PRIMARY PRIMARY 4 NULL 64 100.00 Using where; Using index +2 DEPENDENT SUBQUERY t2 NULL eq_ref PRIMARY PRIMARY 4 test.t1.a 1 100.00 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) @@ -894,8 +894,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range idx1 idx1 10 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range idx1 idx1 10 NULL 2 100.00 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/suite/maria/maria-gis-rtree-dynamic.result b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result index 9caa92fc520..80085a79b11 100644 --- a/mysql-test/suite/maria/maria-gis-rtree-dynamic.result +++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.result @@ -167,8 +167,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 11 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 11 100.00 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) @@ -301,8 +301,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range g g 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range g g 34 NULL 4 100.00 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) diff --git a/mysql-test/suite/maria/maria-gis-rtree-trans.result b/mysql-test/suite/maria/maria-gis-rtree-trans.result index e161b7c60f3..fe751af5ba0 100644 --- a/mysql-test/suite/maria/maria-gis-rtree-trans.result +++ b/mysql-test/suite/maria/maria-gis-rtree-trans.result @@ -167,8 +167,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 11 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 11 100.00 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) @@ -301,8 +301,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range g g 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range g g 34 NULL 4 100.00 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) diff --git a/mysql-test/suite/maria/maria-gis-rtree.result b/mysql-test/suite/maria/maria-gis-rtree.result index b6b1ab2bb9c..d9aa20b7021 100644 --- a/mysql-test/suite/maria/maria-gis-rtree.result +++ b/mysql-test/suite/maria/maria-gis-rtree.result @@ -167,8 +167,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range g g 34 NULL 11 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range g g 34 NULL 11 100.00 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) @@ -301,8 +301,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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range g g 34 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range g g 34 NULL 4 100.00 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) diff --git a/mysql-test/suite/maria/maria.result b/mysql-test/suite/maria/maria.result index a2a1fa68571..63d04b756e7 100644 --- a/mysql-test/suite/maria/maria.result +++ b/mysql-test/suite/maria/maria.result @@ -76,29 +76,29 @@ drop table t1; create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)); 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 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 filesort explain select * from t1 order by b; -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 +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 filesort explain select * from t1 order by c; -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 +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 filesort explain select a from t1 order by a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL PRIMARY 4 NULL 4 100.00 Using index explain select b from t1 order by b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL b 4 NULL 4 100.00 Using index explain select a,b from t1 order by b; -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 +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 filesort explain select a,b from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 explain select a,b,c from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 4 +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 drop table t1; set autocommit=0; begin; @@ -379,37 +379,37 @@ 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.a=t2.a; -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 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 100.00 +1 SIMPLE t1 NULL ref a a 4 test.t2.a 1 100.00 explain select * from t1,t2 force index(a) where t1.a=t2.a; -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 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 100.00 +1 SIMPLE t1 NULL ref a a 4 test.t2.a 1 100.00 explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; -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 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL a NULL NULL NULL 2 100.00 +1 SIMPLE t1 NULL ref a a 4 test.t2.a 1 100.00 explain select * from t1,t2 where t1.b=t2.b; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL b NULL NULL NULL 2 100.00 Using where +1 SIMPLE t1 NULL ref b b 5 test.t2.b 1 100.00 explain select * from t1,t2 force index(c) where t1.a=t2.a; -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 a a 4 test.t2.a 1 +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 ref a a 4 test.t2.a 1 100.00 explain select * from t1 where a=0 or a=2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 4 NULL 5 100.00 Using index condition explain select * from t1 force index (a) where a=0 or a=2; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 4 NULL 5 100.00 Using index condition explain select * from t1 where c=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 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c,c_2 c 5 const 2 100.00 explain select * from t1 use index() where c=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 +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 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)); @@ -551,13 +551,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 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 +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 Using temporary +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index explain select distinct t1.a from t1,t2 order by t2.a; -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 +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 Using temporary +1 SIMPLE t2 NULL index NULL PRIMARY 4 NULL 2 100.00 Using index drop table t1,t2; create table t1 ( c1 varchar(32), @@ -667,15 +667,15 @@ 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx idx 4 const 2 Using where +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 insert into t1 values(1,'a'); explain select count(*) from t1 where a is null; -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 +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 explain select count(*) from t1 where a = 'a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref idx idx 4 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref idx idx 4 const 1 100.00 Using where select count(*) from t1 where a is null; count(*) 2 @@ -1135,23 +1135,23 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where; Using index explain select count(*) from t1 where c='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref c c 11 const # 100.00 Using where; Using index explain select count(*) from t1 where t='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref t t 13 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 13 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 13 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 13 const # 100.00 Using where; Using index alter table t1 add unique(v); ERROR 23000: Duplicate entry '{ ' for key 'v_2' show warnings; @@ -1173,8 +1173,8 @@ qq *a *a*a * *a *a*a * explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v,v_2 # 13 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v,v_2 # 13 const # # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1337,20 +1337,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 303 NULL # 100.00 Using where; Using index explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 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 partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # 100.00 Using where; Using index explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 303 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 303 const # # Using index condition select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1417,20 +1417,20 @@ select count(*) from t1 where v like 'a %'; count(*) 9 explain select count(*) from t1 where v='a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v like 'a%'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range v v 33 NULL # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a '; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # 100.00 Using where explain select * from t1 where v='a'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref v v 33 const # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref v v 33 const # # Using where select v,count(*) from t1 group by v limit 10; v count(*) a 1 @@ -1586,8 +1586,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref ba ba 20 const,const 1 100.00 Using where; Using index select * from t1 where a=20 and b is null; a b 20 NULL diff --git a/mysql-test/suite/maria/mrr.result b/mysql-test/suite/maria/mrr.result index b1b75c8124a..61450c948bf 100644 --- a/mysql-test/suite/maria/mrr.result +++ b/mysql-test/suite/maria/mrr.result @@ -186,8 +186,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 16 2.86 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 @@ -208,8 +208,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 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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 NULL range idx1 idx1 29 NULL 32 100.00 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 @@ -363,10 +363,10 @@ COUNT(t1.v) EXPLAIN SELECT COUNT(t1.v) FROM t1, t2 IGNORE INDEX (idx), t3 IGNORE INDEX (idx) WHERE t3.v = t2.v AND t3.i < t2.i AND t3.pk > 0 AND t2.pk > 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL idx 7 NULL 15 Using index -1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 NULL ALL PRIMARY NULL NULL NULL 25 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 NULL idx 7 NULL 15 100.00 Using index +1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 16 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ALL PRIMARY NULL NULL NULL 25 100.00 Using where; Using join buffer (flat, BNL join) SELECT COUNT(t1.v) FROM t1, t2, t3 WHERE t3.v = t2.v AND t3.i < t2.i AND t3.pk > 0 AND t2.pk > 0; COUNT(t1.v) @@ -374,10 +374,10 @@ COUNT(t1.v) EXPLAIN SELECT COUNT(t1.v) FROM t1, t2, t3 WHERE t3.v = t2.v AND t3.i < t2.i AND t3.pk > 0 AND t2.pk > 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL idx 7 NULL 15 Using index -1 SIMPLE t2 NULL ALL PRIMARY,idx NULL NULL NULL 16 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 NULL ref PRIMARY,idx idx 3 test.t2.v 2 Using index condition; Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL idx 7 NULL 15 100.00 Using index +1 SIMPLE t2 NULL ALL PRIMARY,idx NULL NULL NULL 16 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL ref PRIMARY,idx idx 3 test.t2.v 2 100.00 Using index condition; Using where set join_cache_level=@save_join_cache_level; DROP TABLE t1,t2,t3; # @@ -403,9 +403,9 @@ EXPLAIN SELECT count(*) FROM t1 AS table1, t2 AS table2 WHERE table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE table2 NULL ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE table1 NULL ref PRIMARY,col_varchar_1024_latin1_key col_varchar_1024_latin1_key 1027 test.table2.col_varchar_10_latin1 2 Using index condition(BKA); 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 table2 NULL ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE table1 NULL ref PRIMARY,col_varchar_1024_latin1_key col_varchar_1024_latin1_key 1027 test.table2.col_varchar_10_latin1 2 100.00 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT count(*) FROM t1 AS table1, t2 AS table2 WHERE diff --git a/mysql-test/suite/maria/ps_maria.result b/mysql-test/suite/maria/ps_maria.result index 3109d18fe1a..9747690dde0 100644 --- a/mysql-test/suite/maria/ps_maria.result +++ b/mysql-test/suite/maria/ps_maria.result @@ -1163,9 +1163,10 @@ def key 253 64 0 Y 0 39 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 filtered 5 4 6 Y 32896 2 63 def Extra 253 255 0 N 1 39 8 -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t9 NULL ALL NULL NULL NULL NULL 2 100.00 drop table if exists t2 ; create table t2 (s varchar(25), fulltext(s)) TRANSACTIONAL= 0 ENGINE = 'ARIA' ; diff --git a/mysql-test/suite/parts/r/optimizer.result b/mysql-test/suite/parts/r/optimizer.result index 64a581e7fff..bb5b2f5d20d 100644 --- a/mysql-test/suite/parts/r/optimizer.result +++ b/mysql-test/suite/parts/r/optimizer.result @@ -21,11 +21,11 @@ INSERT INTO t1 SELECT a + 40, b + 40 FROM t1; INSERT INTO t2 SELECT * FROM t1; # plans should be identical EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0 range a a 5 NULL 2 100.00 Using where; Using index EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range a a 5 NULL 2 100.00 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/suite/parts/r/partition_alter3_innodb.result b/mysql-test/suite/parts/r/partition_alter3_innodb.result index 66531c2b699..bc13672a4ef 100644 --- a/mysql-test/suite/parts/r/partition_alter3_innodb.result +++ b/mysql-test/suite/parts/r/partition_alter3_innodb.result @@ -61,8 +61,8 @@ t1 CREATE TABLE `t1` ( t1.frm t1.ibd EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -85,8 +85,8 @@ t1#P#p0.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -104,8 +104,8 @@ t1#P#p0.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -121,8 +121,8 @@ t1#P#p0.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -149,8 +149,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -177,8 +177,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 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 5 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -210,8 +210,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 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 # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -253,8 +253,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -281,8 +281,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -307,8 +307,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 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 4 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -331,8 +331,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 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 5 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -353,8 +353,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -373,8 +373,8 @@ t1#P#part1.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 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 10 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -391,8 +391,8 @@ t1#P#p0.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -410,8 +410,8 @@ t1 CREATE TABLE `t1` ( t1.frm t1.ibd EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -451,8 +451,8 @@ t1 CREATE TABLE `t1` ( t1.frm t1.ibd EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -476,8 +476,8 @@ t1#P#p0.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -507,8 +507,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -535,8 +535,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -571,8 +571,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -612,8 +612,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 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 4 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -643,8 +643,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 3 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -672,8 +672,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 10 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -699,8 +699,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -724,8 +724,8 @@ t1#P#part7.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -747,8 +747,8 @@ t1#P#part1.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 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 10 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -768,8 +768,8 @@ t1#P#p0.ibd t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -790,8 +790,8 @@ t1 CREATE TABLE `t1` ( t1.frm t1.ibd EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 diff --git a/mysql-test/suite/parts/r/partition_alter3_myisam.result b/mysql-test/suite/parts/r/partition_alter3_myisam.result index 1a412bc27a4..bb847e673c0 100644 --- a/mysql-test/suite/parts/r/partition_alter3_myisam.result +++ b/mysql-test/suite/parts/r/partition_alter3_myisam.result @@ -60,8 +60,8 @@ t1.MYD t1.MYI t1.frm EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -85,8 +85,8 @@ t1#P#p0.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -105,8 +105,8 @@ t1#P#p0.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -123,8 +123,8 @@ t1#P#p0.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -154,8 +154,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -186,8 +186,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 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 5 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -227,8 +227,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 3 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 # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -277,8 +277,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -311,8 +311,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 4 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -342,8 +342,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 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 4 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -370,8 +370,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 5 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 5 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -395,8 +395,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part1 ALL NULL NULL NULL NULL 7 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -417,8 +417,8 @@ t1#P#part1.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 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 10 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -436,8 +436,8 @@ t1#P#p0.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -456,8 +456,8 @@ t1.MYD t1.MYI t1.frm EXPLAIN PARTITIONS SELECT COUNT(*) FROM t1 WHERE f_date = '1000-02-10'; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -492,8 +492,8 @@ t1.MYD t1.MYI t1.frm EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -518,8 +518,8 @@ t1#P#p0.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -552,8 +552,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -584,8 +584,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -628,8 +628,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p6 ALL NULL NULL NULL NULL 3 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -676,8 +676,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 4 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 4 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -713,8 +713,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 3 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -747,8 +747,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 10 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 10 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -778,8 +778,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 5 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -806,8 +806,8 @@ t1#P#part7.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 part7 ALL NULL NULL NULL NULL 7 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -831,8 +831,8 @@ t1#P#part1.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 10 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 10 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -853,8 +853,8 @@ t1#P#p0.MYI t1.frm t1.par EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 20 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 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 @@ -876,8 +876,8 @@ t1.MYD t1.MYI t1.frm EXPLAIN PARTITIONS SELECT COUNT(*) <> 1 FROM t1 WHERE f_int1 = 3; -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 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 20 100.00 Using where # check read single success: 1 # check read all success: 1 # check read row by row success: 1 diff --git a/mysql-test/suite/perfschema/r/digest_view.result b/mysql-test/suite/perfschema/r/digest_view.result index 10d2976c60e..15886de8038 100644 --- a/mysql-test/suite/perfschema/r/digest_view.result +++ b/mysql-test/suite/perfschema/r/digest_view.result @@ -148,20 +148,20 @@ CREATE TABLE test.t1 (a int, b int); INSERT INTO test.t1 VALUES (1, 100), (2, 200), (3, 300); TRUNCATE TABLE performance_schema.events_statements_summary_by_digest; EXPLAIN SELECT * from test.v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 100.00 EXPLAIN SELECT * from test.v1 where a = 1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where EXPLAIN SELECT * from test.v1 where b > 100; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 100.00 Using where EXPLAIN SELECT a, b from test.v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 100.00 EXPLAIN SELECT b, a from test.v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE v1 NULL ALL NULL NULL NULL NULL 3 100.00 SELECT * from test.v1; a b 1 100 @@ -205,20 +205,20 @@ test 61e13f96828d862446f5e8ee1cade61d TRUNCATE TABLE `performance_schema` . `eve DROP TABLE test.v1; CREATE VIEW test.v1 AS SELECT * FROM test.t1; EXPLAIN SELECT * from test.v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 EXPLAIN SELECT * from test.v1 where a = 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 Using where +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 EXPLAIN SELECT * from test.v1 where b > 100; -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 +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 EXPLAIN SELECT a, b from test.v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 EXPLAIN SELECT b, a from test.v1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 3 +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 SELECT * from test.v1; a b 1 100 diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result index 9af2536a03b..56b5718edd3 100644 --- a/mysql-test/suite/perfschema/r/misc.result +++ b/mysql-test/suite/perfschema/r/misc.result @@ -96,8 +96,8 @@ show global variables like "performance_schema_max_thread_instances"; Variable_name Value performance_schema_max_thread_instances 200 explain select * from performance_schema.threads; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE threads NULL ALL NULL NULL NULL NULL 256 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE threads NULL ALL NULL NULL NULL NULL 256 100.00 use performance_schema; show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation diff --git a/mysql-test/suite/plugins/r/audit_null.result b/mysql-test/suite/plugins/r/audit_null.result index 0bc8c2fc681..ddd43dcccf9 100644 --- a/mysql-test/suite/plugins/r/audit_null.result +++ b/mysql-test/suite/plugins/r/audit_null.result @@ -48,8 +48,8 @@ a alter table t2 add column b int; drop table t2; explain select distinct * from t2; -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 temporary +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 temporary select distinct * from t2; a b 1 NULL diff --git a/mysql-test/suite/sql_sequence/next.result b/mysql-test/suite/sql_sequence/next.result index 2bbe9d18b8d..904cf06ce31 100644 --- a/mysql-test/suite/sql_sequence/next.result +++ b/mysql-test/suite/sql_sequence/next.result @@ -441,11 +441,11 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si drop sequence s1; CREATE SEQUENCE t1 start with 5 minvalue 1 maxvalue 10 increment by 1 cache 5 cycle; explain select next value for t1; -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 +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 explain select next value for t1, minimum_value from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL system NULL NULL NULL NULL 1 +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 drop table t1; CREATE SEQUENCE s1; CREATE TABLE t1 (a int); diff --git a/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result b/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result index bf33f2e920e..512ed95db0b 100644 --- a/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result +++ b/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result @@ -15,9 +15,9 @@ SELECT @@global.max_seeks_for_key; 20 INSERT INTO t1(b) VALUES("AREc"); EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; -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 system NULL NULL NULL NULL 1 +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 SET @@session.max_seeks_for_key = 2; SELECT @@session.max_seeks_for_key; @@session.max_seeks_for_key @@ -25,9 +25,9 @@ SELECT @@session.max_seeks_for_key; INSERT INTO t1(b) VALUES("BREc"); INSERT INTO t1(b) VALUES("CRec"); EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; -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; 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 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) '#--------------------FN_DYNVARS_084_02-------------------------#' CONNECT test_con2,localhost,root,,; connection test_con2; @@ -43,9 +43,9 @@ SELECT @@global.max_seeks_for_key; 20 INSERT INTO t1(b) VALUES("AREc"); EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; -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) +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) SET @@session.max_seeks_for_key = 2; SELECT @@session.max_seeks_for_key; @@session.max_seeks_for_key @@ -53,26 +53,26 @@ SELECT @@session.max_seeks_for_key; INSERT INTO t1(b) VALUES("BREc"); INSERT INTO t1(b) VALUES("CRec"); EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 -1 SIMPLE t2 NULL 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 filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 6 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) INSERT INTO t1 VALUES(null,"test"); INSERT INTO t1 VALUES (null,"a"),(null,"a"),(null,"a"), (null,"a"),(null,"a"),(null,"a"),(null,"a"), (null,"a"),(null,"a"),(null,"a"); EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 17 -1 SIMPLE t2 NULL 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 filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 17 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 17 100.00 Using where; Using join buffer (flat, BNL join) ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK SET MAX_SEEKS_FOR_KEY=1; EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 17 -1 SIMPLE t2 NULL 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 filtered Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 17 100.00 +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 17 100.00 Using where; Using join buffer (flat, BNL join) SET MAX_SEEKS_FOR_KEY=DEFAULT; connection default; disconnect test_con1; diff --git a/mysql-test/suite/vcol/r/vcol_keys_myisam.result b/mysql-test/suite/vcol/r/vcol_keys_myisam.result index 13da74f2597..487d134e0c9 100644 --- a/mysql-test/suite/vcol/r/vcol_keys_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_keys_myisam.result @@ -216,8 +216,8 @@ create table t1 (a int, b int as (a+1), c int, index(b)); insert t1 (a,c) values (0x7890abcd, 0x76543210); insert t1 (a,c) select seq, sin(seq)*10000 from seq_1_to_1000; explain select * from t1 where b=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref b b 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref b b 5 const 1 100.00 select * from t1 where b=10; a b c 9 10 4121 diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index 65ec4bce4ba..6055b8f2b84 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -232,9 +232,9 @@ insert into t2(c,d) values set join_cache_level=6; explain select * from t1,t2 where t1.b=t2.c and d <= 100; -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 idx idx 5 test.t1.b 2 Using where +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 ref idx idx 5 test.t1.b 2 100.00 Using where select * from t1,t2 where t1.b=t2.c and d <= 100; a b c d v 3 30 30 100 101 diff --git a/mysql-test/suite/vcol/r/vcol_select_innodb.result b/mysql-test/suite/vcol/r/vcol_select_innodb.result index a627c9497f7..c5fad21d825 100644 --- a/mysql-test/suite/vcol/r/vcol_select_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_select_innodb.result @@ -17,45 +17,45 @@ select * from t2; a b c 1 -1 -1 explain select * from t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 1 100.00 select * from t2 where c=-1; a b c 1 -1 -1 explain select * from t2 where c=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL ref c c 5 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL ref c c 5 const 1 100.00 # select_type=SIMPLE, type=ALL select * from t1 where b=-1; a b c 1 -1 -1 1 -1 -1 explain select * from t1 where 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 5 Using where +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 # select_type=SIMPLE, type=const select * from t3 where a=1; a b c 1 -1 -1 explain select * from t3 where a=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 # select_type=SIMPLE, type=range select * from t3 where c>=-1; a b c 1 -1 -1 explain select * from t3 where c>=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 1 100.00 Using index condition # select_type=SIMPLE, type=ref select * from t1,t3 where t1.c=t3.c and t3.c=-1; a b c a b c 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 explain select * from t1,t3 where t1.c=t3.c and t3.c=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL const c c 5 const 1 -1 SIMPLE t1 NULL ref c c 5 const 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const c c 5 const 1 100.00 +1 SIMPLE t1 NULL ref c c 5 const 2 100.00 # select_type=PRIMARY, type=index,ALL select * from t1 where b in (select c from t3); a b c @@ -64,9 +64,9 @@ a b c 1 -1 -1 3 -3 -3 explain select * from t1 where b in (select c from t3); -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 t3 NULL eq_ref c c 5 test.t1.b 1 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 5 100.00 Using where +1 PRIMARY t3 NULL eq_ref c c 5 test.t1.b 1 100.00 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c @@ -74,9 +74,9 @@ a b c 1 -1 -1 1 -1 -1 explain select * from t1 where c in (select c from t3 where c between -2 and -1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t3 NULL range c c 5 NULL 2 Using where; Using index -1 PRIMARY t1 NULL ref c c 5 test.t3.c 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL range c c 5 NULL 2 100.00 Using where; Using index +1 PRIMARY t1 NULL ref c c 5 test.t3.c 1 100.00 # select_type=UNION, type=system # select_type=UNION RESULT, type=<union1,2> select * from t1 union select * from t2; @@ -86,10 +86,10 @@ a b c 3 -3 -3 NULL NULL NULL explain select * from t1 union select * from t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 -2 UNION t2 NULL ALL NULL NULL NULL NULL 1 -NULL UNION RESULT <union1,2> NULL ALL 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 1 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL # select_type=DERIVED, type=system set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; @@ -101,9 +101,9 @@ a b c 3 -3 -3 NULL NULL NULL explain select * from (select a,b,c from t1) as t11; -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 t1 NULL ALL NULL NULL NULL NULL 5 +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 set optimizer_switch=@tmp_optimizer_switch; ### ### Using aggregate functions with/without DISTINCT @@ -113,29 +113,29 @@ select count(*) from t1; count(*) 5 explain select count(*) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 5 100.00 Using index # SELECT COUNT(DISTINCT <non-vcol>) FROM tbl_name select count(distinct a) from t1; count(distinct a) 3 explain select count(distinct a) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 # SELECT COUNT(DISTINCT <non-stored vcol>) FROM tbl_name select count(distinct b) from t1; count(distinct b) 3 explain select count(distinct b) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 # SELECT COUNT(DISTINCT <stored vcol>) FROM tbl_name select count(distinct c) from t1; count(distinct c) 3 explain select count(distinct c) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range NULL c 5 NULL 6 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 c 5 NULL 6 100.00 Using index for group-by ### ### filesort & range-based utils ### @@ -145,88 +145,88 @@ a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c >= -2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT * FROM tbl_name WHERE <non-vcol expr> select * from t3 where a between 1 and 2; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where a between 1 and 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> select * from t3 where b between -2 and -1; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where b between -2 and -1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 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 6 100.00 Using where # SELECT * FROM tbl_name WHERE <indexed vcol expr> select * from t3 where c between -2 and -1; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <non-indexed vcol> select * from t3 where a between 1 and 2 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where a between 1 and 2 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using filesort # SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol> select * from t3 where a between 1 and 2 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where a between 1 and 2 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using where; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol> select * from t3 where b between -2 and -1 order by a; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where b between -2 and -1 order by a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL index NULL PRIMARY 4 NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL index NULL PRIMARY 4 NULL 6 100.00 Using where # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-indexed vcol> select * from t3 where b between -2 and -1 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where b between -2 and -1 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <non-indexed vcol> select * from t3 where c between -2 and -1 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol> select * from t3 where b between -2 and -1 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where b between -2 and -1 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <indexed vcol> select * from t3 where c between -2 and -1 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol> select sum(b) from t1 group by b; sum(b) @@ -235,8 +235,8 @@ NULL -2 -2 explain select sum(b) from t1 group by b; -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 +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 temporary; Using filesort # SELECT sum(<indexed vcol>) FROM tbl_name GROUP BY <indexed vcol> select sum(c) from t1 group by c; sum(c) @@ -245,8 +245,8 @@ NULL -2 -2 explain select sum(c) from t1 group by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 5 100.00 Using index # SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <indexed vcol> select sum(b) from t1 group by c; sum(b) @@ -255,8 +255,8 @@ NULL -2 -2 explain select sum(b) from t1 group by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 5 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 5 100.00 # SELECT sum(<indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol> select sum(c) from t1 group by b; sum(c) @@ -265,6 +265,6 @@ NULL -2 -2 explain select sum(c) from t1 group by b; -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 +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 temporary; Using filesort SET GLOBAL innodb_stats_persistent=@save_stats_persistent; diff --git a/mysql-test/suite/vcol/r/vcol_select_myisam.result b/mysql-test/suite/vcol/r/vcol_select_myisam.result index f542d6b462d..835b81b9b20 100644 --- a/mysql-test/suite/vcol/r/vcol_select_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_select_myisam.result @@ -15,45 +15,45 @@ select * from t2; a b c 1 -1 -1 explain select * from t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL system NULL NULL NULL NULL 1 +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 select * from t2 where c=-1; a b c 1 -1 -1 explain select * from t2 where c=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL system c NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL system c NULL NULL NULL 1 100.00 # select_type=SIMPLE, type=ALL select * from t1 where b=-1; a b c 1 -1 -1 1 -1 -1 explain select * from t1 where 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 5 Using where +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 # select_type=SIMPLE, type=const select * from t3 where a=1; a b c 1 -1 -1 explain select * from t3 where a=1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const PRIMARY PRIMARY 4 const 1 100.00 # select_type=SIMPLE, type=range select * from t3 where c>=-1; a b c 1 -1 -1 explain select * from t3 where c>=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 1 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 1 100.00 Using index condition # select_type=SIMPLE, type=ref select * from t1,t3 where t1.c=t3.c and t3.c=-1; a b c a b c 1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 explain select * from t1,t3 where t1.c=t3.c and t3.c=-1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL const c c 5 const 1 -1 SIMPLE t1 NULL ref c c 5 const 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL const c c 5 const 1 100.00 +1 SIMPLE t1 NULL ref c c 5 const 2 100.00 # select_type=PRIMARY, type=index,ALL select * from t1 where b in (select c from t3); a b c @@ -62,9 +62,9 @@ a b c 1 -1 -1 3 -3 -3 explain select * from t1 where b in (select c from t3); -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 t3 NULL eq_ref c c 5 test.t1.b 1 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 5 100.00 Using where +1 PRIMARY t3 NULL eq_ref c c 5 test.t1.b 1 100.00 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c @@ -72,9 +72,9 @@ a b c 1 -1 -1 1 -1 -1 explain select * from t1 where c in (select c from t3 where c between -2 and -1); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t3 NULL range c c 5 NULL 2 Using where; Using index -1 PRIMARY t1 NULL ref c c 5 test.t3.c 2 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t3 NULL range c c 5 NULL 2 100.00 Using where; Using index +1 PRIMARY t1 NULL ref c c 5 test.t3.c 2 100.00 # select_type=UNION, type=system # select_type=UNION RESULT, type=<union1,2> select * from t1 union select * from t2; @@ -84,10 +84,10 @@ a b c 3 -3 -3 NULL NULL NULL explain select * from t1 union select * from t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY t1 NULL ALL NULL NULL NULL NULL 5 -2 UNION t2 NULL system NULL NULL NULL NULL 1 -NULL UNION RESULT <union1,2> NULL ALL 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 system NULL NULL NULL NULL 1 100.00 +NULL UNION RESULT <union1,2> NULL ALL NULL NULL NULL NULL NULL NULL # select_type=DERIVED, type=system set @tmp_optimizer_switch=@@optimizer_switch; set optimizer_switch='derived_merge=off,derived_with_keys=off'; @@ -99,9 +99,9 @@ a b c 3 -3 -3 NULL NULL NULL explain select * from (select a,b,c from t1) as t11; -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 t1 NULL ALL NULL NULL NULL NULL 5 +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 set optimizer_switch=@tmp_optimizer_switch; ### ### Using aggregate functions with/without DISTINCT @@ -111,29 +111,29 @@ select count(*) from t1; count(*) 5 explain select count(*) from t1; -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 +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 # SELECT COUNT(DISTINCT <non-vcol>) FROM tbl_name select count(distinct a) from t1; count(distinct a) 3 explain select count(distinct a) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 # SELECT COUNT(DISTINCT <non-stored vcol>) FROM tbl_name select count(distinct b) from t1; count(distinct b) 3 explain select count(distinct b) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 5 +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 # SELECT COUNT(DISTINCT <stored vcol>) FROM tbl_name select count(distinct c) from t1; count(distinct c) 3 explain select count(distinct c) from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range NULL c 5 NULL 6 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 c 5 NULL 6 100.00 Using index for group-by ### ### filesort & range-based utils ### @@ -143,88 +143,88 @@ a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c >= -2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT * FROM tbl_name WHERE <non-vcol expr> select * from t3 where a between 1 and 2; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where a between 1 and 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> select * from t3 where b between -2 and -1; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where b between -2 and -1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 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 6 100.00 Using where # SELECT * FROM tbl_name WHERE <indexed vcol expr> select * from t3 where c between -2 and -1; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol> select * from t3 where a between 1 and 2 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where a between 1 and 2 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range PRIMARY PRIMARY 4 NULL 2 100.00 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol> select * from t3 where b between -2 and -1 order by a; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where b between -2 and -1 order by a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <non-vcol> select * from t3 where c between -2 and -1 order by a; a b c 1 -1 -1 2 -2 -2 explain select * from t3 where c between -2 and -1 order by a; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-indexed vcol> select * from t3 where b between -2 and -1 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where b between -2 and -1 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <non-indexed vcol> select * from t3 where c between -2 and -1 order by b; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1 order by b; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol> select * from t3 where b between -2 and -1 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where b between -2 and -1 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL ALL NULL NULL NULL NULL 6 100.00 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <indexed vcol> select * from t3 where c between -2 and -1 order by c; a b c 2 -2 -2 1 -1 -1 explain select * from t3 where c between -2 and -1 order by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 NULL range c c 5 NULL 2 Using index condition +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t3 NULL range c c 5 NULL 2 100.00 Using index condition # SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol> select sum(b) from t1 group by b; sum(b) @@ -233,8 +233,8 @@ NULL -2 -2 explain select sum(b) from t1 group by b; -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 +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 temporary; Using filesort # SELECT sum(<indexed vcol>) FROM tbl_name GROUP BY <indexed vcol> select sum(c) from t1 group by c; sum(c) @@ -243,8 +243,8 @@ NULL -2 -2 explain select sum(c) from t1 group by c; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index NULL c 5 NULL 5 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index NULL c 5 NULL 5 100.00 Using index # SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <indexed vcol> select sum(b) from t1 group by c; sum(b) @@ -253,8 +253,8 @@ NULL -2 -2 explain select sum(b) from t1 group by c; -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 +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 temporary; Using filesort # SELECT sum(<indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol> select sum(c) from t1 group by b; sum(c) @@ -263,8 +263,8 @@ NULL -2 -2 explain select sum(c) from t1 group by b; -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 +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 temporary; Using filesort # # Bug #806057: join with USING over a virtual column # @@ -315,10 +315,10 @@ key (vi, vc)); insert t2 (bi, bc) values (1, 'c'), (8, 'm'), (9, 'd'), (6, 'y'), (1, 't'), (6, 'd'), (2, 's'), (4, 'r'), (8, 'm'), (4, 'b'), (4, 'x'), (7, 'g'), (4, 'p'), (1, 'q'), (9, 'w'), (4, 'd'), (8, 'e'), (4, 'b'), (8, 'y'); explain # should be using join buffer select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc)); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL vi 10 NULL 19 Using index -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 19 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 NULL index NULL PRIMARY 4 NULL 19 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 t2 NULL index NULL vi 10 NULL 19 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 19 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL index NULL PRIMARY 4 NULL 19 100.00 Using where; Using index; Using join buffer (incremental, BNL join) select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc)); vi 1 @@ -424,10 +424,10 @@ key (vi, vc)); insert t2 (bi, bc) values (1, 'c'), (8, 'm'), (9, 'd'), (6, 'y'), (1, 't'), (6, 'd'), (2, 's'), (4, 'r'), (8, 'm'), (4, 'b'), (4, 'x'), (7, 'g'), (4, 'p'), (1, 'q'), (9, 'w'), (4, 'd'), (8, 'e'), (4, 'b'), (8, 'y'); explain # should be using join buffer select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc)); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL index NULL vi 10 NULL 19 Using index -1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 19 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t3 NULL index NULL PRIMARY 4 NULL 19 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 t2 NULL index NULL vi 10 NULL 19 100.00 Using index +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 19 100.00 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t3 NULL index NULL PRIMARY 4 NULL 19 100.00 Using where; Using index; Using join buffer (incremental, BNL join) select t2.vi from (t2 as t3 right join (t2 left join t1 on (t1.bi = t2.vi)) on (t1.vc = t2.vc)); vi 1 diff --git a/mysql-test/suite/vcol/r/vcol_view_innodb.result b/mysql-test/suite/vcol/r/vcol_view_innodb.result index f327058452f..7f99ef4d51f 100644 --- a/mysql-test/suite/vcol/r/vcol_view_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_view_innodb.result @@ -64,9 +64,9 @@ b -2 -3 explain select * from v1; -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 +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 Using temporary select * from t1; a b c 1 -1 -1 @@ -83,9 +83,9 @@ c -2 -3 explain select * from v1; -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 +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 Using temporary select * from t1; a b c 1 -1 -1 @@ -108,9 +108,9 @@ b+1 MariaDB-5.3: the following EXPLAIN produces incorrect #rows for table t1. MariaDB-5.3: this is expected to go away when FROM subquery optimizations are pushed explain select * from v1; -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 +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 4 100.00 Using filesort drop view v1; create view v1 as select c+1 from t1 order by 1 desc limit 2; select * from v1; @@ -120,9 +120,9 @@ c+1 MariaDB-5.3: the following EXPLAIN produces incorrect #rows for table t1. MariaDB-5.3: this is expected to go away when FROM subquery optimizations are pushed explain select * from v1; -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 +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 4 100.00 Using filesort drop view v1; drop table t1; create table t1 (a int, diff --git a/mysql-test/suite/vcol/r/vcol_view_myisam.result b/mysql-test/suite/vcol/r/vcol_view_myisam.result index 5c98de80e4a..33fa30bb2d1 100644 --- a/mysql-test/suite/vcol/r/vcol_view_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_view_myisam.result @@ -62,9 +62,9 @@ b -2 -3 explain select * from v1; -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 +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 Using temporary select * from t1; a b c 1 -1 -1 @@ -81,9 +81,9 @@ c -2 -3 explain select * from v1; -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 +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 Using temporary select * from t1; a b c 1 -1 -1 @@ -106,9 +106,9 @@ b+1 MariaDB-5.3: the following EXPLAIN produces incorrect #rows for table t1. MariaDB-5.3: this is expected to go away when FROM subquery optimizations are pushed explain select * from v1; -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 +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 4 100.00 Using filesort drop view v1; create view v1 as select c+1 from t1 order by 1 desc limit 2; select * from v1; @@ -118,9 +118,9 @@ c+1 MariaDB-5.3: the following EXPLAIN produces incorrect #rows for table t1. MariaDB-5.3: this is expected to go away when FROM subquery optimizations are pushed explain select * from v1; -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 +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 4 100.00 Using filesort drop view v1; drop table t1; create table t1 (a int, diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index d25227a4ce7..a268dfb6bdf 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -379,18 +379,18 @@ i 4 6 explain partitions select * from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL # 100.00 Using where explain partitions select * from t1 for system_time as of '2001-02-04 10:20:30'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p2_p2sp0,p2_p2sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p0_p0sp0,p0_p0sp1,p2_p2sp0,p2_p2sp1,pn_pnsp0,pn_pnsp1 ALL NULL NULL NULL NULL # 100.00 Using where set @ts=(select row_end from t1 for system_time all where i=1); select * from t1 for system_time all where row_end = @ts; i 1 explain partitions select * from t1 for system_time all where row_end = @ts; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1_p1sp0,p1_p1sp1 # NULL NULL NULL NULL # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1_p1sp0,p1_p1sp1 # NULL NULL NULL NULL # # # # # MDEV-16023 Unfortunate error message WARN_VERS_PART_FULL # @@ -1147,11 +1147,11 @@ select *, row_start, row_end from t1 for system_time as of '2000-01-01 02:00:00' x row_start row_end 1 2000-01-01 00:00:00.000000 2000-01-01 02:00:01.000000 explain partitions select * from t1 for system_time as of '2000-01-01 02:00:00'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p1,pn ALL NULL NULL NULL NULL # Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 p1,pn ALL NULL NULL NULL NULL # 100.00 Using where explain partitions select * from t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 pn # NULL NULL NULL NULL # # +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 pn # NULL NULL NULL NULL # # # drop table t1; # # MDEV-27244 Table corruption upon adding serial data type diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index d940f3e75e8..cfb7998520f 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -313,7 +313,7 @@ explain partitions select * from t1; explain partitions select * from t1 for system_time as of '2001-02-04 10:20:30'; set @ts=(select row_end from t1 for system_time all where i=1); select * from t1 for system_time all where row_end = @ts; ---replace_column 5 # 10 # 11 # +--replace_column 5 # 10 # 11 # 12 # explain partitions select * from t1 for system_time all where row_end = @ts; --echo # @@ -1026,7 +1026,7 @@ update t1 set x= x + 1; select *, row_start, row_end from t1 for system_time as of '2000-01-01 02:00:00'; --replace_column 10 # explain partitions select * from t1 for system_time as of '2000-01-01 02:00:00'; ---replace_column 5 # 10 # 11 # +--replace_column 5 # 10 # 11 # 12 # explain partitions select * from t1; drop table t1; diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result index e55117e6608..1310971e0da 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result @@ -1324,13 +1324,13 @@ CREATE TABLE t1 (a INET6, b VARCHAR(32), KEY (a), KEY(b)) ; INSERT INTO t1 VALUES ('::a','::a'),('::a','::b'); SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner); -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 index NULL a 17 NULL 2 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 2 100.00 Using where +2 MATERIALIZED t1 NULL index NULL a 17 NULL 2 100.00 Using index EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner); -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 a a 17 func 2 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 2 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 17 func 2 100.00 Using index; Using where SET @@optimizer_switch=DEFAULT; DROP TABLE t1; # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result index ace9afd2266..3eb0e439b67 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result @@ -24,15 +24,15 @@ SELECT * FROM t1 WHERE a='::ff'; a ::ff EXPLAIN SELECT * FROM t1 WHERE a='::ff'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index SELECT * FROM t1 WHERE a='garbage'; a Warnings: Warning 1292 Incorrect inet6 value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a='garbage'; -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 +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: Warning 1292 Incorrect inet6 value: 'garbage' SELECT * FROM t1 WHERE a>='::fe'; @@ -40,21 +40,21 @@ a ::fe ::ff EXPLAIN SELECT * FROM t1 WHERE a>='::fe'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a>='garbage'; a EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; -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 +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 SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0'); a ::80 ::a0 ::f0 EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 3 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 17 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage'); a ::80 @@ -62,8 +62,8 @@ a Warnings: Warning 1292 Incorrect inet6 value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index Warnings: Warning 1292 Incorrect inet6 value: 'garbage' SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81'; @@ -71,13 +71,13 @@ a ::80 ::81 EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage'; a EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage'; -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 +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 SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6); a ::ff diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result index 899fdc9c8bd..823b538c858 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result @@ -24,15 +24,15 @@ SELECT * FROM t1 WHERE a='::ff'; a ::ff EXPLAIN SELECT * FROM t1 WHERE a='::ff'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where SELECT * FROM t1 WHERE a='garbage'; a Warnings: Warning 1292 Incorrect inet6 value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a='garbage'; -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 +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: Warning 1292 Incorrect inet6 value: 'garbage' SELECT * FROM t1 WHERE a>='::fe'; @@ -40,23 +40,23 @@ a ::fe ::ff EXPLAIN SELECT * FROM t1 WHERE a>='::fe'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 100.00 Using where SELECT * FROM t1 WHERE a>='garbage'; a Warnings: Warning 1292 Incorrect inet6 value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 100.00 Using where SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0'); a ::80 ::a0 ::f0 EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 17 NULL 6 100.00 Using where SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage'); a ::80 @@ -64,8 +64,8 @@ a Warnings: Warning 1292 Incorrect inet6 value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 17 NULL 4 100.00 Using where Warnings: Warning 1292 Incorrect inet6 value: 'garbage' SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81'; @@ -73,8 +73,8 @@ a ::80 ::81 EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 100.00 Using where SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage'; a Warnings: @@ -143,8 +143,8 @@ Warning 1292 Incorrect inet6 value: 'garbage' Warning 1292 Incorrect inet6 value: 'garbage' Warning 1292 Incorrect inet6 value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 100.00 Using where SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6); a ::ff diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result index 37f0c913a2a..dd850c01719 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result @@ -24,15 +24,15 @@ SELECT * FROM t1 WHERE a='::ff'; a ::ff EXPLAIN SELECT * FROM t1 WHERE a='::ff'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index SELECT * FROM t1 WHERE a='garbage'; a Warnings: Warning 1292 Incorrect inet6 value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a='garbage'; -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 +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: Warning 1292 Incorrect inet6 value: 'garbage' SELECT * FROM t1 WHERE a>='::fe'; @@ -40,21 +40,21 @@ a ::fe ::ff EXPLAIN SELECT * FROM t1 WHERE a>='::fe'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a>='garbage'; a EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; -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 +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 SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0'); a ::80 ::a0 ::f0 EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 3 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 17 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage'); a ::80 @@ -62,8 +62,8 @@ a Warnings: Warning 1292 Incorrect inet6 value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index Warnings: Warning 1292 Incorrect inet6 value: 'garbage' SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81'; @@ -71,13 +71,13 @@ a ::80 ::81 EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage'; a EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage'; -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 +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 SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6); a ::ff @@ -96,15 +96,15 @@ SELECT * FROM t1 WHERE c>CAST('::1' AS INET6); c ::2 EXPLAIN SELECT * FROM t1 WHERE c>CAST('::1' AS INET6); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index c c 67 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index c c 67 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE c=CAST('::1' AS INET6); c 0::1 ::1 EXPLAIN SELECT * FROM t1 WHERE c=CAST('::1' AS INET6); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL index c c 67 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL index c c 67 NULL 3 100.00 Using where; Using index DROP TABLE t1; # # End of 10.5 tests diff --git a/plugin/type_test/mysql-test/type_test/type_test_double.result b/plugin/type_test/mysql-test/type_test/type_test_double.result index a7bb0451fa8..d4f68d35956 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_double.result +++ b/plugin/type_test/mysql-test/type_test/type_test_double.result @@ -304,8 +304,8 @@ DROP TABLE t1; CREATE TABLE t1 (a TEST_DOUBLE, KEY(a)); INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7); EXPLAIN SELECT * FROM t1 WHERE a=3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 9 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 9 const 1 100.00 Using index DROP TABLE t1; # Testing aggregation for result CREATE TABLE t1 (a TEST_DOUBLE); diff --git a/plugin/type_test/mysql-test/type_test/type_test_int8.result b/plugin/type_test/mysql-test/type_test/type_test_int8.result index 9af7f7e6e22..fc80fb82d8c 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_int8.result +++ b/plugin/type_test/mysql-test/type_test/type_test_int8.result @@ -283,8 +283,8 @@ DROP TABLE t1; CREATE TABLE t1 (a TEST_INT8, KEY(a)); INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7); EXPLAIN SELECT * FROM t1 WHERE a=3; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 9 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 9 const 1 100.00 Using index DROP TABLE t1; # Testing aggregation for result CREATE TABLE t1 (a TEST_INT8); diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result index bc7e3f6677e..22e40511222 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.result @@ -2518,13 +2518,13 @@ INSERT INTO t1 VALUES ); SET @@optimizer_switch='semijoin=off,materialization=on,in_to_exists=off,subquery_cache=off'; EXPLAIN SELECT * FROM t1 WHERE a IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner); -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 index NULL a 17 NULL 2 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 2 100.00 Using where +2 MATERIALIZED t1 NULL index NULL a 17 NULL 2 100.00 Using index EXPLAIN SELECT * FROM t1 WHERE b IN (SELECT a AS a_inner FROM t1 GROUP BY a_inner); -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 a a 17 func 2 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 2 100.00 Using where +2 DEPENDENT SUBQUERY t1 NULL index_subquery a a 17 func 2 100.00 Using index; Using where SET @@optimizer_switch=DEFAULT; DROP TABLE t1; # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result index 6d35f6bff84..caddc3dedcc 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_innodb.result @@ -24,15 +24,15 @@ SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; a 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index SELECT * FROM t1 WHERE a='garbage'; a Warnings: Warning 1292 Incorrect uuid value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a='garbage'; -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 +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: Warning 1292 Incorrect uuid value: 'garbage' SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; @@ -40,13 +40,13 @@ a 00000000-0000-0000-0000-0000000000fe 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a>='garbage'; a EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; -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 +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 SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -63,8 +63,8 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000a0', '00000000-0000-0000-0000-0000000000f0' ); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 3 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 17 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -82,8 +82,8 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000a0', 'garbage' ); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index Warnings: Warning 1292 Incorrect uuid value: 'garbage' SELECT * FROM t1 WHERE a BETWEEN @@ -95,8 +95,8 @@ a EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND '00000000-0000-0000-0000-000000000081'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND 'garbage'; @@ -104,8 +104,8 @@ a EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND 'garbage'; -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 +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 SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); a 00000000-0000-0000-0000-0000000000ff @@ -145,38 +145,38 @@ END FOR; $$ COMMIT; EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index DROP TABLE t1; # # MDEV-26742 Assertion `field->type_handler() == this' failed in FixedBinTypeBundle<NATIVE_LEN, MAX_CHAR_LEN>::Type_handler_fbt::stored_field_cmp_to_item @@ -192,9 +192,9 @@ d pk c Warnings: Warning 1292 Incorrect uuid value: '2' EXPLAIN SELECT * FROM t2 JOIN t1 ON ( t1.pk > t2.d); -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 d NULL NULL NULL 1 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 d NULL NULL NULL 1 100.00 Using where UPDATE t2 JOIN t1 ON ( t1.pk > t2.d) SET t1.c = 1; ERROR 22007: Incorrect uuid value: '2' DROP TABLE t1, t2; diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result index 9b967fea32c..f6f9b5898e9 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_memory.result @@ -24,15 +24,15 @@ SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; a 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 4 100.00 Using where SELECT * FROM t1 WHERE a='garbage'; a Warnings: Warning 1292 Incorrect uuid value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a='garbage'; -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 +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: Warning 1292 Incorrect uuid value: 'garbage' SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; @@ -40,15 +40,15 @@ a 00000000-0000-0000-0000-0000000000fe 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 100.00 Using where SELECT * FROM t1 WHERE a>='garbage'; a Warnings: Warning 1292 Incorrect uuid value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 100.00 Using where SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -65,8 +65,8 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000a0', '00000000-0000-0000-0000-0000000000f0' ); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 12 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 17 NULL 12 100.00 Using where SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -84,8 +84,8 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000a0', 'garbage' ); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 8 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL range a a 17 NULL 8 100.00 Using where Warnings: Warning 1292 Incorrect uuid value: 'garbage' SELECT * FROM t1 WHERE a BETWEEN @@ -97,8 +97,8 @@ a EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND '00000000-0000-0000-0000-000000000081'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 100.00 Using where SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND 'garbage'; @@ -171,8 +171,8 @@ Warning 1292 Incorrect uuid value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND 'garbage'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ALL a NULL NULL NULL 256 100.00 Using where SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); a 00000000-0000-0000-0000-0000000000ff @@ -212,38 +212,38 @@ END FOR; $$ COMMIT; EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 2 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 2 100.00 Using where DROP TABLE t1; # # End of 10.5 tests diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result index 4b545d04b84..f220906e691 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid_myisam.result @@ -24,15 +24,15 @@ SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; a 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-0000000000ff'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index SELECT * FROM t1 WHERE a='garbage'; a Warnings: Warning 1292 Incorrect uuid value: 'garbage' EXPLAIN SELECT * FROM t1 WHERE a='garbage'; -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 +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: Warning 1292 Incorrect uuid value: 'garbage' SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; @@ -40,13 +40,13 @@ a 00000000-0000-0000-0000-0000000000fe 00000000-0000-0000-0000-0000000000ff EXPLAIN SELECT * FROM t1 WHERE a>='00000000-0000-0000-0000-0000000000fe'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 3 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 17 NULL 3 100.00 Using where; Using index SELECT * FROM t1 WHERE a>='garbage'; a EXPLAIN SELECT * FROM t1 WHERE a>='garbage'; -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 +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 SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -63,8 +63,8 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000a0', '00000000-0000-0000-0000-0000000000f0' ); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 4 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 17 NULL 4 100.00 Using where; Using index SELECT * FROM t1 WHERE a IN ( '00000000-0000-0000-0000-000000000080', @@ -82,8 +82,8 @@ EXPLAIN SELECT * FROM t1 WHERE a IN '00000000-0000-0000-0000-0000000000a0', 'garbage' ); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index Warnings: Warning 1292 Incorrect uuid value: 'garbage' SELECT * FROM t1 WHERE a BETWEEN @@ -95,8 +95,8 @@ a EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND '00000000-0000-0000-0000-000000000081'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL range a a 17 NULL 2 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 17 NULL 2 100.00 Using where; Using index SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND 'garbage'; @@ -104,8 +104,8 @@ a EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '00000000-0000-0000-0000-000000000080' AND 'garbage'; -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 +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 SELECT * FROM t1 WHERE a=CAST('00000000-0000-0000-0000-0000000000ff' AS UUID); a 00000000-0000-0000-0000-0000000000ff @@ -145,38 +145,38 @@ END FOR; $$ COMMIT; EXPLAIN SELECT * FROM t1 WHERE a='ff000000-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00ff0000-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='0000ff00-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='000000ff-0000-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-ff00-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-00ff-0000-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-ff00-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-00ff-0000-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-ff00-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-00ff-000000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index EXPLAIN SELECT * FROM t1 WHERE a='00000000-0000-0000-0000-ff0000000000'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref a a 17 const 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref a a 17 const 1 100.00 Using where; Using index DROP TABLE t1; # # Testing index prefix compression diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0463db0865e..471b21ec218 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -2753,6 +2753,7 @@ void THD::make_explain_field_list(List<Item> &field_list, uint8 explain_flags, field_list.push_back(item=new (mem_root) Item_empty_string(this, "rows", NAME_CHAR_LEN, cs), mem_root); + item->set_maybe_null(); if (is_analyze) { field_list.push_back(item= new (mem_root) @@ -2761,13 +2762,10 @@ void THD::make_explain_field_list(List<Item> &field_list, uint8 explain_flags, item->set_maybe_null(); } - if (is_analyze || (explain_flags & DESCRIBE_EXTENDED)) - { - field_list.push_back(item= new (mem_root) - Item_float(this, "filtered", 0.1234, 2, 4), - mem_root); - item->set_maybe_null(); - } + field_list.push_back(item= new (mem_root) + Item_float(this, "filtered", 0.1234, 2, 4), + mem_root); + item->set_maybe_null(); if (is_analyze) { @@ -2777,7 +2775,6 @@ void THD::make_explain_field_list(List<Item> &field_list, uint8 explain_flags, item->set_maybe_null(); } - item->set_maybe_null(); field_list.push_back(new (mem_root) Item_empty_string(this, "Extra", 255, cs), mem_root); diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 19fdfb84c8d..e4bc20299c7 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -419,8 +419,7 @@ int print_explain_row(select_result_sink *result, /* 'filtered' */ const double filtered=100.0; - if (options & DESCRIBE_EXTENDED || is_analyze) - item_list.push_back(new (mem_root) Item_float(thd, filtered, 2), mem_root); + item_list.push_back(new (mem_root) Item_float(thd, filtered, 2), mem_root); /* 'r_filtered' */ if (is_analyze) @@ -560,8 +559,7 @@ int Explain_union::print_explain(Explain_query *query, } /* `filtered` */ - if (explain_flags & DESCRIBE_EXTENDED || is_analyze) - item_list.push_back(item_null, mem_root); + item_list.push_back(item_null, mem_root); /* `r_filtered` */ if (is_analyze) @@ -794,8 +792,7 @@ int Explain_select::print_explain(Explain_query *query, item_list.push_back(item_null, mem_root); /* filtered */ - if (is_analyze || explain_flags & DESCRIBE_EXTENDED) - item_list.push_back(item_null, mem_root); + item_list.push_back(item_null, mem_root); if (is_analyze) { @@ -1406,16 +1403,13 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai } /* `filtered` */ - if (explain_flags & DESCRIBE_EXTENDED || is_analyze) + if (filtered_set) { - if (filtered_set) - { - item_list.push_back(new (mem_root) Item_float(thd, filtered, 2), - mem_root); - } - else - item_list.push_back(item_null, mem_root); + item_list.push_back(new (mem_root) Item_float(thd, filtered, 2), + mem_root); } + else + item_list.push_back(item_null, mem_root); /* `r_filtered` */ if (is_analyze) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 66d3d85b68e..09f36936a7e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2411,7 +2411,7 @@ JOIN::optimize_inner() conjunctions. Preserve conditions for EXPLAIN. */ - if (conds && !(thd->lex->describe & DESCRIBE_EXTENDED)) + if (conds && !thd->lex->describe) { COND *table_independent_conds= make_cond_for_table(thd, conds, PSEUDO_TABLE_BITS, 0, -1, @@ -4995,7 +4995,7 @@ mysql_select(THD *thd, TABLE_LIST *tables, List<Item> &fields, COND *conds, goto err; // 1 } - if (thd->lex->describe & DESCRIBE_EXTENDED) + if (thd->lex->describe) { join->conds_history= join->conds; join->having_history= (join->having?join->having:join->tmp_having); @@ -5006,7 +5006,7 @@ mysql_select(THD *thd, TABLE_LIST *tables, List<Item> &fields, COND *conds, join->exec(); - if (thd->lex->describe & DESCRIBE_EXTENDED) + if (thd->lex->describe) { select_lex->where= join->conds_history; select_lex->having= join->having_history; @@ -26918,8 +26918,7 @@ int print_explain_message_line(select_result_sink *result, item_list.push_back(item_null, mem_root); /* `filtered` */ - if (is_analyze || options & DESCRIBE_EXTENDED) - item_list.push_back(item_null, mem_root); + item_list.push_back(item_null, mem_root); /* `r_filtered` */ if (is_analyze) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index c9bc2b6ada9..59bd7154d03 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -9663,6 +9663,7 @@ ST_FIELD_INFO show_explain_tabular_fields_info[]= Column("key_len", Varchar(NAME_CHAR_LEN*MAX_KEY), NULLABLE, "key_len"), Column("ref", Varchar(NAME_CHAR_LEN*MAX_REF_PARTS),NULLABLE, "ref"), Column("rows", SLonglong(10), NULLABLE, "rows"), + Column("filtered", Decimal(502), NULLABLE, "filtered"), Column("Extra", Varchar(255), NOT_NULL, "Extra"), CEnd() }; diff --git a/storage/connect/mysql-test/connect/r/alter.result b/storage/connect/mysql-test/connect/r/alter.result index 76258a8d9e8..690c4e963d1 100644 --- a/storage/connect/mysql-test/connect/r/alter.result +++ b/storage/connect/mysql-test/connect/r/alter.result @@ -13,8 +13,8 @@ c d 3 Three CREATE INDEX xc ON t1(c); DESCRIBE SELECT * FROM t1 WHERE c = 2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref xc xc 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref xc xc 4 const 1 100.00 DROP INDEX xc ON t1; CREATE INDEX xd ON t1(d); DROP INDEX xd ON t1; diff --git a/storage/connect/mysql-test/connect/r/bson.result b/storage/connect/mysql-test/connect/r/bson.result index ea8e3b65eaa..7f51a3f256f 100644 --- a/storage/connect/mysql-test/connect/r/bson.result +++ b/storage/connect/mysql-test/connect/r/bson.result @@ -199,8 +199,8 @@ ISBN Language Subject AuthorFN AuthorLN Title Translation TranslatorFN Translato 9782212090819 fr applications Fran�ois Knab Construire une application XML NULL NULL NULL Eyrolles Paris 1999 9782840825685 fr applications William J. Pardi XML en Action adapt� de l'anglais par James Guerin Microsoft Press Paris 2001 DESCRIBE SELECT * FROM t1 WHERE ISBN = '9782212090819'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref IX IX 15 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref IX IX 15 const 1 100.00 Using where UPDATE t1 SET AuthorFN = 'Philippe' WHERE ISBN = '9782212090819'; ERROR HY000: Got error 122 'Cannot write expanded column when Pretty is not 2' from CONNECT DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/json.result b/storage/connect/mysql-test/connect/r/json.result index 7b2a3b817f7..f62c55e33f3 100644 --- a/storage/connect/mysql-test/connect/r/json.result +++ b/storage/connect/mysql-test/connect/r/json.result @@ -199,8 +199,8 @@ ISBN Language Subject AuthorFN AuthorLN Title Translation TranslatorFN Translato 9782212090819 fr applications Fran�ois Knab Construire une application XML NULL NULL NULL Eyrolles Paris 1999 9782840825685 fr applications William J. Pardi XML en Action adapt� de l'anglais par James Guerin Microsoft Press Paris 2001 DESCRIBE SELECT * FROM t1 WHERE ISBN = '9782212090819'; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 NULL ref IX IX 15 const 1 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 NULL ref IX IX 15 const 1 100.00 Using where UPDATE t1 SET AuthorFN = 'Philippe' WHERE ISBN = '9782212090819'; ERROR HY000: Got error 122 'Cannot write expanded column when Pretty is not 2' from CONNECT DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/mysql_index.result b/storage/connect/mysql-test/connect/r/mysql_index.result index ebeea414eda..35b51a3c58b 100644 --- a/storage/connect/mysql-test/connect/r/mysql_index.result +++ b/storage/connect/mysql-test/connect/r/mysql_index.result @@ -172,8 +172,8 @@ matricule nom prenom 4080 FOCH SERGE 3368 MOGADOR ALAIN explain SELECT matricule, nom, prenom FROM t2 WHERE nom IN ('FOCH','MOGADOR'); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 NULL range NP NP 18 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 NULL range NP NP 18 NULL 4 100.00 Using where SELECT matricule, nom, prenom FROM t2 WHERE nom = 'FOCH' OR nom = 'MOGADOR'; matricule nom prenom 1977 FOCH BERNADETTE diff --git a/storage/connect/mysql-test/connect/r/part_file.result b/storage/connect/mysql-test/connect/r/part_file.result index 79a7cac0f29..7ef7218c5ab 100644 --- a/storage/connect/mysql-test/connect/r/part_file.result +++ b/storage/connect/mysql-test/connect/r/part_file.result @@ -33,8 +33,8 @@ id msg 60 sixty 81 eighty one EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 last ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 last ALL NULL NULL NULL NULL 3 100.00 Using where SELECT * FROM t1 WHERE id > 50; id msg 60 sixty @@ -66,8 +66,8 @@ t1#P#first .csv t1#P#last .csv t1#P#middle .csv EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id=10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 first ALL NULL NULL NULL NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 first ALL NULL NULL NULL NULL 3 100.00 Using where SELECT * FROM t1 WHERE id=10; id msg 10 ten @@ -140,14 +140,14 @@ rwid rnum prtn tbn fid id msg 3 3 3 t1 part3 72 seventy two 2 2 3 t1 part3 81 eighty one EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 2 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 2 const PRIMARY PRIMARY 4 const 1 100.00 SELECT * FROM t1 WHERE id = 10; rwid rnum prtn tbn fid id msg 1 1 2 t1 part2 10 ten EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 40; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 2,3 range PRIMARY PRIMARY 4 NULL 4 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 2,3 range PRIMARY PRIMARY 4 NULL 4 100.00 Using where SELECT * FROM t1 WHERE id >= 40; rwid rnum prtn tbn fid id msg 2 2 2 t1 part2 40 forty @@ -168,8 +168,8 @@ prtn count(*) 2 4 3 3 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 3 range PRIMARY PRIMARY 4 NULL 3 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 3 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where SELECT * FROM t1 WHERE id = 35; rwid rnum prtn tbn fid id msg 4 4 2 t1 part2 35 thirty five @@ -305,8 +305,8 @@ part2 .txt part3 .fnx part3 .txt EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 1 ref XID XID 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 1 ref XID XID 4 const 1 100.00 DROP INDEX XID ON t1; SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored @@ -328,8 +328,8 @@ part2 .txt part3 .fnx part3 .txt EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 1 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 1 const PRIMARY PRIMARY 4 const 1 100.00 ALTER TABLE t1 DROP PRIMARY KEY; SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Ignored diff --git a/storage/connect/mysql-test/connect/r/part_table.result b/storage/connect/mysql-test/connect/r/part_table.result index 0cd4f0115a4..b46056f4521 100644 --- a/storage/connect/mysql-test/connect/r/part_table.result +++ b/storage/connect/mysql-test/connect/r/part_table.result @@ -91,8 +91,8 @@ id msg 72 seventy two EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 81; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 3 ALL NULL NULL NULL NULL 6 Using where +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 3 ALL NULL NULL NULL NULL 6 100.00 Using where DELETE FROM t1; Warnings: Note 1105 xt1: 4 affected rows @@ -136,8 +136,8 @@ id msg 60 sixty 81 eighty one EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 81; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 3 const PRIMARY PRIMARY 4 const 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 3 const PRIMARY PRIMARY 4 const 1 100.00 SELECT * FROM t1 WHERE id = 7; id msg 7 seven diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result index 7abd7b96050..7f6ce0095b8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/geometry_contains.result @@ -162,6 +162,6 @@ EXPLAIN SELECT id, name, ST_AsText(location) AS location_text FROM shops WHERE MBRContains(ST_GeomFromText('LineString(139.7727 35.6684, 139.7038 35.7121)'), location) ORDER BY id; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE shops NULL range location_index location_index 34 NULL 36 Using where; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE shops NULL range location_index location_index 34 NULL 36 100.00 Using where; Using filesort DROP TABLE shops; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result index 574dad2629c..97fec37730a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_global.result @@ -14,7 +14,7 @@ INSERT INTO ids VALUES (9); INSERT INTO ids VALUES (10); SET GLOBAL mroonga_max_n_records_for_estimate = 1; EXPLAIN SELECT * FROM ids WHERE id > 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE ids NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ids NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index SET GLOBAL mroonga_max_n_records_for_estimate = DEFAULT; DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result index b97aba8153f..3b4be0a7f54 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_not_found_in_limit.result @@ -10,7 +10,7 @@ INSERT INTO ids VALUES (4),(5),(6),(7); DELETE FROM ids WHERE id < 2; SET mroonga_max_n_records_for_estimate = 1; EXPLAIN SELECT * FROM ids WHERE id > 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE ids NULL range id id 5 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ids NULL range id id 5 NULL 1 100.00 Using where; Using index SET mroonga_max_n_records_for_estimate = DEFAULT; DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_session.result b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_session.result index 345ee6044c1..ff8bef605f5 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_session.result +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_max_n_records_for_estimate_session.result @@ -14,7 +14,7 @@ INSERT INTO ids VALUES (9); INSERT INTO ids VALUES (10); SET mroonga_max_n_records_for_estimate = 1; EXPLAIN SELECT * FROM ids WHERE id > 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE ids NULL range PRIMARY PRIMARY 4 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE ids NULL range PRIMARY PRIMARY 4 NULL 1 100.00 Using where; Using index SET mroonga_max_n_records_for_estimate = DEFAULT; DROP TABLE ids; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result index 84730f655bc..ea61cdac29d 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result +++ b/storage/mroonga/mysql-test/mroonga/wrapper/r/count_star_with_index.result @@ -17,10 +17,10 @@ INSERT INTO diaries_mroonga (body) VALUES ("will start groonga!"); INSERT INTO diaries_mroonga (body) VALUES ("starting groonga..."); INSERT INTO diaries_mroonga (body) VALUES ("started groonga."); EXPLAIN SELECT COUNT(*) FROM diaries_innodb; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE diaries_innodb NULL index NULL flag 2 # 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE diaries_innodb NULL index NULL flag 2 # 3 100.00 Using index EXPLAIN SELECT COUNT(*) FROM diaries_mroonga; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE diaries_mroonga NULL index NULL flag 2 # 3 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE diaries_mroonga NULL index NULL flag 2 # 3 100.00 Using index DROP TABLE diaries_innodb; DROP TABLE diaries_mroonga; diff --git a/storage/sequence/mysql-test/sequence/group_by.result b/storage/sequence/mysql-test/sequence/group_by.result index db34299f6e7..00ba4964656 100644 --- a/storage/sequence/mysql-test/sequence/group_by.result +++ b/storage/sequence/mysql-test/sequence/group_by.result @@ -14,43 +14,43 @@ select count(*) from seq_1_to_15_step_2; count(*) 8 explain select count(*) from seq_1_to_15_step_2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +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 Storage engine handles GROUP BY select count(seq) from seq_1_to_15_step_2; count(seq) 8 explain select count(seq) from seq_1_to_15_step_2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +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 Storage engine handles GROUP BY select sum(seq) from seq_1_to_15_step_2; sum(seq) 64 explain select sum(seq) from seq_1_to_15_step_2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +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 Storage engine handles GROUP BY select count(seq),sum(seq) from seq_1_to_15_step_2; count(seq) sum(seq) 8 64 explain select count(seq),sum(seq) from seq_1_to_15_step_2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +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 Storage engine handles GROUP BY select count(seq) as c from seq_1_to_15_step_2 having c > 5; c 8 explain select count(seq) as c from seq_1_to_15_step_2 having c > 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +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 Storage engine handles GROUP BY select count(seq) as c from seq_1_to_15_step_2 having c > 1000; c explain select count(seq) as c from seq_1_to_15_step_2 having c > 1000; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +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 Storage engine handles GROUP BY select distinct count(*) from seq_1_to_15_step_2; count(*) 8 explain select distinct count(*) from seq_1_to_15_step_2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Storage engine handles GROUP BY +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 Storage engine handles GROUP BY select * from seq_1_to_15_step_2, (select count(*) from seq_1_to_15_step_2) as t1; seq count(*) 1 8 @@ -62,10 +62,10 @@ seq count(*) 13 8 15 8 explain select * from seq_1_to_15_step_2, (select count(*) from seq_1_to_15_step_2) as t1; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL # Using index -1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # Using join buffer (flat, BNL join) -2 DERIVED NULL NULL NULL NULL NULL NULL NULL # Storage engine handles GROUP BY +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL # 100.00 Using index +1 PRIMARY <derived2> NULL ALL NULL NULL NULL NULL # 100.00 Using join buffer (flat, BNL join) +2 DERIVED NULL NULL NULL NULL NULL NULL NULL # NULL Storage engine handles GROUP BY create view v1 as select count(*) from seq_1_to_15_step_2; select * from v1; count(*) @@ -78,18 +78,18 @@ select count(seq),sum(seq),1 from seq_1_to_15_step_2; count(seq) sum(seq) 1 8 64 1 explain select count(seq),sum(seq),1 from seq_1_to_15_step_2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL 8 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL 8 100.00 Using index explain select count(*) from seq_1_to_15_step_2, seq_1_to_15_step_2 as t2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL 8 Using index -1 SIMPLE t2 NULL index NULL PRIMARY 8 NULL 8 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 seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL 8 100.00 Using index +1 SIMPLE t2 NULL index NULL PRIMARY 8 NULL 8 100.00 Using index; Using join buffer (flat, BNL join) explain select count(*) from seq_1_to_15_step_2 where seq > 0; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL index PRIMARY PRIMARY 8 NULL 8 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_1_to_15_step_2 NULL index PRIMARY PRIMARY 8 NULL 8 100.00 Using where; Using index explain select count(*) from seq_1_to_15_step_2 group by mod(seq,2); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL 8 Using index; Using temporary; Using filesort +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL 8 100.00 Using index; Using temporary; Using filesort create temporary table t1 select * from seq_1_to_3; select count(NULL) from t1; count(NULL) diff --git a/storage/sequence/mysql-test/sequence/simple.result b/storage/sequence/mysql-test/sequence/simple.result index 5aa9b49c838..226c1d51577 100644 --- a/storage/sequence/mysql-test/sequence/simple.result +++ b/storage/sequence/mysql-test/sequence/simple.result @@ -108,8 +108,8 @@ select * from seq_15_to_1_step_12345; seq 15 explain select * from seq_15_to_1_step_12345; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_15_to_1_step_12345 NULL ALL NULL NULL NULL NULL 1 +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_15_to_1_step_12345 NULL ALL NULL NULL NULL NULL 1 100.00 show open tables from test; Database Table In_use Name_locked test seq_15_to_1 0 0 @@ -122,29 +122,29 @@ test seq_1_to_15_step_2 0 0 show tables; Tables_in_test explain select * from seq_1_to_15_step_2; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL 8 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_1_to_15_step_2 NULL index NULL PRIMARY 8 NULL 8 100.00 Using index explain select * from seq_1_to_15_step_2 where seq > 10; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL range PRIMARY PRIMARY 8 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_1_to_15_step_2 NULL range PRIMARY PRIMARY 8 NULL 3 100.00 Using where; Using index explain select * from seq_1_to_15_step_2 where seq between 4 and 9; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL range PRIMARY PRIMARY 8 NULL 3 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_1_to_15_step_2 NULL range PRIMARY PRIMARY 8 NULL 3 100.00 Using where; Using index explain select * from seq_1_to_15_step_2 where seq between 20 and 30; -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 +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 explain select * from seq_1_to_15_step_2 where seq between 4 and 6; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL range PRIMARY PRIMARY 8 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_1_to_15_step_2 NULL range PRIMARY PRIMARY 8 NULL 1 100.00 Using where; Using index explain select * from seq_1_to_15_step_2 where seq between 4 and 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL range PRIMARY PRIMARY 8 NULL 1 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_1_to_15_step_2 NULL range PRIMARY PRIMARY 8 NULL 1 100.00 Using where; Using index explain select * from seq_1_to_15_step_2 where seq between 4 and 4; -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 +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 explain select * from seq_1_to_15_step_2 where seq between 5 and 5; -id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE seq_1_to_15_step_2 NULL const PRIMARY PRIMARY 8 const 1 Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 SIMPLE seq_1_to_15_step_2 NULL const PRIMARY PRIMARY 8 const 1 100.00 Using index create table t1 (a int, aa int, b varchar(100)); insert t1 select seq, seq*seq, if (seq % 2, 'odd', 'even') from seq_1_to_20; select * from t1; @@ -234,9 +234,9 @@ seq 47 explain select seq from seq_2_to_50 s1 where 0 not in (select s1.seq % s2.seq from seq_2_to_50 s2 where s2.seq <= sqrt(s1.seq)); -id select_type table partitions type possible_keys key key_len ref rows Extra -1 PRIMARY s1 NULL index NULL PRIMARY 8 NULL 49 Using where; Using index -2 DEPENDENT SUBQUERY s2 NULL index PRIMARY PRIMARY 8 NULL 49 Using where; Using index +id select_type table partitions type possible_keys key key_len ref rows filtered Extra +1 PRIMARY s1 NULL index NULL PRIMARY 8 NULL 49 100.00 Using where; Using index +2 DEPENDENT SUBQUERY s2 NULL index PRIMARY PRIMARY 8 NULL 49 100.00 Using where; Using index select year(dt) from (select '1901-02-28' + interval seq year as dt from seq_0_to_99) as seqdt where weekday(dt) = 0;
participants (1)
-
psergey