1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Added thread variable max_seeks_for_key

Change optimizer to prefer key lookups before table scan
Change table scans to be done after tables with constrains on scanned table 


mysql-test/r/distinct.result:
  Update results
mysql-test/r/group_by.result:
  Update results
mysql-test/r/heap.result:
  Update results
mysql-test/r/join.result:
  Update results
mysql-test/r/key_diff.result:
  Update results
mysql-test/r/myisam.result:
  Update results
mysql-test/r/order_by.result:
  Update results
mysql-test/r/select_safe.result:
  Update results
mysql-test/t/distinct.test:
  Change test to be repeatable
mysql-test/t/join.test:
  Change test to be repeatable
mysql-test/t/select_safe.test:
  Add tests for MAX_SEEKS_FOR_KEY
sql/handler.h:
  Optimize structure for 64 bit machines (and to avoid problems with gdb)
sql/item_cmpfunc.cc:
  Initialize not_null_tables_cache properly
sql/mysqld.cc:
  Added max_seeks_for_key
sql/set_var.cc:
  Added max_seeks_for_key
sql/sql_class.h:
  Added max_seeks_for_key
sql/sql_select.cc:
  Added max_seeks_for_key
  Change optimizer to prefer key lookups before table scan.
  Change table scans to be done after tables with constrains on scanned table
This commit is contained in:
unknown
2003-06-27 03:04:54 +03:00
parent 7539980eb1
commit c2cb9b97be
17 changed files with 114 additions and 65 deletions

View File

@ -161,7 +161,7 @@ SELECT DISTINCT UserId FROM t1 WHERE UserId=22;
UserId
drop table t1;
CREATE TABLE t1 (a int(10) unsigned not null primary key,b int(10) unsigned);
INSERT INTO t1 VALUES (1,1),(2,1);
INSERT INTO t1 VALUES (1,1),(2,1),(3,1),(4,1);
CREATE TABLE t2 (a int(10) unsigned not null, key (A));
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t3 (a int(10) unsigned, key(A), b text);
@ -189,7 +189,7 @@ 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;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
t3 ref a a 5 t1.a 10 Using where; Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
@ -200,16 +200,16 @@ select distinct 1 from t1,t3 where t1.a=t3.a;
1
explain SELECT distinct t1.a from t1;
table type possible_keys key key_len ref rows Extra
t1 index NULL PRIMARY 4 NULL 2 Using index
t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT distinct t1.a from t1 order by a desc;
table type possible_keys key key_len ref rows Extra
t1 index NULL PRIMARY 4 NULL 2 Using index
t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT t1.a from t1 group by a order by a desc;
table type possible_keys key key_len ref rows Extra
t1 index NULL PRIMARY 4 NULL 2 Using index
t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT distinct t1.a from t1 order by a desc limit 1;
table type possible_keys key key_len ref rows Extra
t1 index NULL PRIMARY 4 NULL 2 Using index
t1 index NULL PRIMARY 4 NULL 4 Using index
explain SELECT distinct a from t3 order by a desc limit 2;
table type possible_keys key key_len ref rows Extra
t3 index NULL a 5 NULL 204 Using index