Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
748b293c
Commit
748b293c
authored
Dec 03, 2021
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More test coverage
parent
c2d2c1e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
2 deletions
+44
-2
mysql-test/main/statistics_json.result
mysql-test/main/statistics_json.result
+22
-0
mysql-test/main/statistics_json.test
mysql-test/main/statistics_json.test
+22
-0
sql/opt_histogram_json.cc
sql/opt_histogram_json.cc
+0
-2
No files found.
mysql-test/main/statistics_json.result
View file @
748b293c
...
...
@@ -8146,3 +8146,25 @@ analyze select * from t1 where a >= 0;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 100 100.00 100.00 100.00 Using where
drop table t1;
#
# More test coverage
#
create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C;
create table t2 (a int);
insert into t2 select 1 from t1;
insert into t2 select (a+1)*10 from t0;
insert into t2 values (0);
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
analyze select * from t2 where a < 1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1011 1011.00 8.33 0.10 Using where
analyze select * from t2 where a =100;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1011 1011.00 0.10 0.10 Using where
drop table t0,t1,t2;
mysql-test/main/statistics_json.test
View file @
748b293c
...
...
@@ -353,3 +353,25 @@ analyze select * from t1 where a < 0;
analyze
select
*
from
t1
where
a
>
0
;
analyze
select
*
from
t1
where
a
>=
0
;
drop
table
t1
;
--
echo
#
--
echo
# More test coverage
--
echo
#
create
table
t0
(
a
int
);
insert
into
t0
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
create
table
t1
(
a
int
);
insert
into
t1
select
A
.
a
+
B
.
a
*
10
+
C
.
a
*
100
from
t0
A
,
t0
B
,
t0
C
;
create
table
t2
(
a
int
);
insert
into
t2
select
1
from
t1
;
insert
into
t2
select
(
a
+
1
)
*
10
from
t0
;
insert
into
t2
values
(
0
);
analyze
table
t2
persistent
for
all
;
analyze
select
*
from
t2
where
a
<
1
;
analyze
select
*
from
t2
where
a
=
100
;
drop
table
t0
,
t1
,
t2
;
sql/opt_histogram_json.cc
View file @
748b293c
...
...
@@ -914,7 +914,6 @@ double Histogram_json_hb::range_selectivity(Field *field, key_range *min_endp,
/*
The range is "col > $CONST" and we've found a bucket that contains
only the value $CONST. Move to the next bucket.
TODO: what if the last value in the histogram is a popular one?
*/
idx
++
;
}
...
...
@@ -948,7 +947,6 @@ double Histogram_json_hb::range_selectivity(Field *field, key_range *min_endp,
/*
The range is "col < $CONST" and we've found a bucket starting with
$CONST. Move to the previous bucket.
TODO: what if the first value is the popular one?
*/
idx
--
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment