Skip to content

Commit ee5bb64

Browse files
author
Erik Froseth
committed
WL#9223 Using histogram statistics in the optimizer
This worklog makes use of histogram statistics in the optimizer during query planning. It is used for estimating the selectivity given one or more predicates. Change-Id: I337a90e71698f0d36d24b8e5ac648a4b7847ec08
1 parent 93f6bad commit ee5bb64

File tree

111 files changed

+14781
-1996
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+14781
-1996
lines changed

mysql-test/include/commit.inc

+14-14
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ if (`SELECT $PS_PROTOCOL > 0`)
828828
}
829829
--echo # One extra transaction to load table 't2' into data-dictionary cache.
830830
do (select f1() from t1 where a=2);
831-
call p_verify_status_increment(2, 2, 3, 2);
831+
call p_verify_status_increment(3, 2, 3, 2);
832832
commit;
833833
call p_verify_status_increment(2, 2, 2, 2);
834834
--enable_warnings
@@ -878,26 +878,26 @@ create table t3 select a from t2;
878878
# COM_PREPARE.
879879
if (`SELECT $PS_PROTOCOL = 0`)
880880
{
881-
--replace_regex /8/<commit_count>/
882-
call p_verify_status_increment(8, 4, 4, 4);
881+
--replace_regex /9/<commit_count>/
882+
call p_verify_status_increment(9, 4, 4, 4);
883883
}
884884
if (`SELECT $PS_PROTOCOL > 0`)
885885
{
886-
--replace_regex /9/<commit_count>/
887-
call p_verify_status_increment(9, 4, 4, 4);
886+
--replace_regex /10/<commit_count>/
887+
call p_verify_status_increment(10, 4, 4, 4);
888888
}
889889
alter table t3 add column (b int);
890890

891891
if (!$have_debug)
892892
{
893-
--replace_regex /11/X/
894-
call p_verify_status_increment(11, 4, 2, 0);
893+
--replace_regex /13/X/
894+
call p_verify_status_increment(13, 4, 2, 0);
895895
}
896896

897897
if ($have_debug)
898898
{
899-
--replace_regex /13/X/
900-
call p_verify_status_increment(13, 4, 2, 0);
899+
--replace_regex /15/X/
900+
call p_verify_status_increment(15, 4, 2, 0);
901901
}
902902

903903
alter table t3 rename t4;
@@ -908,14 +908,14 @@ truncate table t3;
908908

909909
if (!$have_debug)
910910
{
911-
--replace_regex /9/X/
912-
call p_verify_status_increment(9, 4, 4, 0);
911+
--replace_regex /11/X/
912+
call p_verify_status_increment(11, 4, 4, 0);
913913
}
914914

915915
if ($have_debug)
916916
{
917-
--replace_regex /10/X/
918-
call p_verify_status_increment(10, 4, 4, 0);
917+
--replace_regex /12/X/
918+
call p_verify_status_increment(12, 4, 4, 0);
919919
}
920920

921921
create view v1 as select * from t2;
@@ -926,7 +926,7 @@ call p_verify_status_increment(2, 0, 2, 0);
926926
commit;
927927
call p_verify_status_increment(0, 0, 0, 0);
928928
check table t1, t2, t3;
929-
call p_verify_status_increment(6, 0, 6, 0);
929+
call p_verify_status_increment(8, 0, 6, 0);
930930
commit;
931931
call p_verify_status_increment(0, 0, 0, 0);
932932
drop view v1;

mysql-test/include/subquery.inc

+1-1
Original file line numberDiff line numberDiff line change
@@ -5141,7 +5141,7 @@ insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
51415141
(6,7),(7,4),(5,3);
51425142

51435143
let $nesting= 26;
5144-
let $should_work_nesting= 5;
5144+
let $should_work_nesting= 4;
51455145
let $start= select sum(a),a from t1 where a> ( select sum(a) from t1 ;
51465146
let $end= )group by a ;
51475147
let $start_app= where a> ( select sum(a) from t1 ;

mysql-test/r/commit_1innodb.result

+2-2
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ SUCCESS
803803

804804
# One extra transaction to load table 't2' into data-dictionary cache.
805805
do (select f1() from t1 where a=2);
806-
call p_verify_status_increment(2, 2, 3, 2);
806+
call p_verify_status_increment(3, 2, 3, 2);
807807
SUCCESS
808808

809809
commit;
@@ -881,7 +881,7 @@ Table Op Msg_type Msg_text
881881
test.t1 check status OK
882882
test.t2 check status OK
883883
test.t3 check status OK
884-
call p_verify_status_increment(6, 0, 6, 0);
884+
call p_verify_status_increment(8, 0, 6, 0);
885885
SUCCESS
886886

887887
commit;

mysql-test/r/create.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
939939
show status like 'handler_read%';
940940
Variable_name Value
941941
Handler_read_first 1
942-
Handler_read_key 17
942+
Handler_read_key 19
943943
Handler_read_last 0
944944
Handler_read_next 0
945945
Handler_read_prev 0

mysql-test/r/create_ps_protocol.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CREATE TABLE t2 SELECT SQL_BIG_RESULT f1, COUNT(f2) FROM t1 GROUP BY f1;
55
SHOW STATUS LIKE 'handler_read%';
66
Variable_name Value
77
Handler_read_first 1
8-
Handler_read_key 18
8+
Handler_read_key 20
99
Handler_read_last 0
1010
Handler_read_next 0
1111
Handler_read_prev 0

mysql-test/r/get_table_share.result

+1
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ SET DEBUG_SYNC= 'now SIGNAL cont_retry_TB1';
437437
# and we know it's stopped at 'open_table_share_found'.
438438
# The only issue left then is to make sure TB1 drops by the
439439
# 'found_share' sync point, then signal TB2 to finish, and we're done:
440+
SET DEBUG_SYNC= 'now SIGNAL finish_TB2';
440441
SET DEBUG_SYNC= 'now WAIT_FOR found_TB1';
441442
SET DEBUG_SYNC= 'now SIGNAL finish_TB2';
442443
#

mysql-test/r/group_min_max.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -2515,7 +2515,7 @@ FLUSH STATUS;
25152515
CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
25162516
SHOW STATUS LIKE 'handler_read__e%';
25172517
Variable_name Value
2518-
Handler_read_key 13
2518+
Handler_read_key 15
25192519
Handler_read_next 0
25202520
FLUSH STATUS;
25212521
SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b;

mysql-test/r/group_min_max_ps_protocol.result

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ FLUSH STATUS;
2828
CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
2929
SHOW STATUS LIKE 'handler_read__e%';
3030
Variable_name Value
31-
Handler_read_key 18
31+
Handler_read_key 20
3232
Handler_read_next 20
3333
FLUSH STATUS;
3434
SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b;
@@ -121,7 +121,7 @@ FLUSH STATUS;
121121
INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
122122
SHOW STATUS LIKE 'handler_read__e%';
123123
Variable_name Value
124-
Handler_read_key 12
124+
Handler_read_key 14
125125
Handler_read_next 0
126126
DELETE FROM t3;
127127
FLUSH STATUS;

mysql-test/r/histogram_equi_height.result

+1,493
Large diffs are not rendered by default.

mysql-test/r/histogram_singleton.result

+1,373
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)