set optimizer_record_context=ON;
select count(*) from t1;
--source include/opt_context_list_sys_vars.inc set optimizer_record_context=OFF;
let $explain_query= explain format= json select * from t1 a,
t1 b where a.c1 < 3and b.c1 < 33;
--source include/opt_ctx_cmp_2_runs_of_query.inc
drop table t1;
--echo #
--echo # Equi-Join query on a single table having 1 non-unique index on a single column.
--echo # Also, index column is used in the condition
--echo #
insert into t1 select seq%5, seq%10 from seq_1_to_200;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1, t1 as tt2 where tt1.c1 = tt2.c1;
--source include/opt_ctx_cmp_2_runs_of_query.inc
drop table t1;
--echo #
--echo # Equi-Join query on a single table having 1 primary key index on a single column.
--echo # Also, index column is used in the condition
--echo #
insert into t1 select seq, seq%5 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1, t1 as tt2 where tt1.c1 = tt2.c1;
--source include/opt_ctx_cmp_2_runs_of_query.inc
drop table t1;
--echo #
--echo # Equi-Join query on a single table having 1 primary key index on 2 columns.
--echo # Both the index columns are used in the condition
--echo #
insert into t1 select seq, seq%5 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1, t1 as tt2 where tt1.c1 = tt2.c1 and tt1.c2 = tt2.c2;
--source include/opt_ctx_cmp_2_runs_of_query.inc
drop table t1;
--echo #
--echo # Equi-Join query on a single table having 1 non-unique index on 2 columns.
--echo # However, only 1 column from the index is used in the condition
--echo #
insert into t1 select seq%5, seq%10 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1, t1 as tt2 where tt1.c1 = tt2.c1;
--source include/opt_ctx_cmp_2_runs_of_query.inc
drop table t1;
--echo #
--echo # Equi-Join query on a single table having 1 primary key index on 2 columns.
--echo # However, only 1 column from the index that has unique values is used in the condition
--echo #
insert into t1 select seq, seq%5 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1, t1 as tt2 where tt1.c1 = tt2.c1;
--source include/opt_ctx_cmp_2_runs_of_query.inc
--echo #
--echo # Equi-Join query on a single table having 1 primary key index on 2 columns.
--echo # However, only 1 column from the index that has non-unique values is used in the condition
--echo #
insert into t1 select seq, seq%5 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1, t1 as tt2 where tt1.c2 = tt2.c2;
--source include/opt_ctx_cmp_2_runs_of_query.inc
--echo #
--echo # Query on a single table having 1 primary key index on 2 columns.
--echo # However, a constant literal is used in the equality predicate with only 1 column from the index that has unique values.
--echo #
insert into t1 select seq, seq%5 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1 where tt1.c1 = 5;
--source include/opt_ctx_cmp_2_runs_of_query.inc
--echo #
--echo # Query on a single table having 1 primary key index on 2 columns.
--echo # However, a constant literal is used in the equality predicate with only 1 column from the index that has non-unique values.
--echo #
insert into t1 select seq, seq%5 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1 where tt1.c2 = 5;
--source include/opt_ctx_cmp_2_runs_of_query.inc
drop table t1;
--echo #
--echo # Query on a single table having 1 non-unique index on 2 columns.
--echo # However, a constant literal is used in the equality predicate using only 1 column from the index.
--echo #
insert into t1 select seq%3, seq%5 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1 where tt1.c1 = 3;
--source include/opt_ctx_cmp_2_runs_of_query.inc
--echo #
--echo # Query on a single table having 1 non-unique index on a single column.
--echo # Also, a constant literal is used in the equality predicate on the column that isin the index.
--echo #
insert into t1 select seq%3, seq%5 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1 where tt1.c1 = 5;
--source include/opt_ctx_cmp_2_runs_of_query.inc
drop table t1;
--echo #
--echo # Query on a single table having 1 primary key index with only 1 column.
--echo # However, a constant literal is used in the equality predicate on the column that isnotin the index.
--echo #
insert into t1 select seq, seq%5 from seq_1_to_100;
analyze table t1;
let $explain_query=explain format=json select * from t1 as tt1 where tt1.c2 = 4;
--source include/opt_ctx_cmp_2_runs_of_query.inc
drop table t1;
--echo #
--echo # Index-Merge query on a single table having 2 non-unique index with a single column in each.
--echo # Also, index column is used in the condition
--echo #
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.