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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2ba25676
Commit
2ba25676
authored
Feb 06, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0
parents
18aba041
d8c96f28
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
0 deletions
+49
-0
mysql-test/r/group_min_max.result
mysql-test/r/group_min_max.result
+27
-0
mysql-test/t/group_min_max.test
mysql-test/t/group_min_max.test
+21
-0
sql/opt_range.cc
sql/opt_range.cc
+1
-0
No files found.
mysql-test/r/group_min_max.result
View file @
2ba25676
...
@@ -2043,3 +2043,30 @@ c1 c2
...
@@ -2043,3 +2043,30 @@ c1 c2
30 8
30 8
30 9
30 9
drop table t1;
drop table t1;
CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b));
INSERT INTO t1 VALUES ('AA',1), ('AA',2), ('AA',3), ('BB',1), ('AA',4);
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SELECT a FROM t1 WHERE a='AA' GROUP BY a;
a
AA
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 type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 3 Using where; Using index
EXPLAIN SELECT a FROM t1 WHERE a='BB' GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref PRIMARY PRIMARY 7 const 1 Using where; Using index
SELECT DISTINCT a FROM t1 WHERE a='BB';
a
BB
SELECT DISTINCT a FROM t1 WHERE a LIKE 'B%';
a
BB
SELECT a FROM t1 WHERE a LIKE 'B%' GROUP BY a;
a
BB
DROP TABLE t1;
mysql-test/t/group_min_max.test
View file @
2ba25676
...
@@ -715,3 +715,24 @@ select distinct c1, c2 from t1 order by c2;
...
@@ -715,3 +715,24 @@ select distinct c1, c2 from t1 order by c2;
select c1,min(c2) as c2 from t1 group by c1 order by c2;
select c1,min(c2) as c2 from t1 group by c1 order by c2;
select c1,c2 from t1 group by c1,c2 order by c2;
select c1,c2 from t1 group by c1,c2 order by c2;
drop table t1;
drop table t1;
#
# Bug #16203: Analysis for possible min/max optimization erroneously
# returns impossible range
#
CREATE TABLE t1 (a varchar(5), b int(11), PRIMARY KEY (a,b));
INSERT INTO t1 VALUES ('
AA
',1), ('
AA
',2), ('
AA
',3), ('
BB
',1), ('
AA
',4);
OPTIMIZE TABLE t1;
SELECT a FROM t1 WHERE a='
AA
' GROUP BY a;
SELECT a FROM t1 WHERE a='
BB
' GROUP BY a;
EXPLAIN SELECT a FROM t1 WHERE a='
AA
' GROUP BY a;
EXPLAIN SELECT a FROM t1 WHERE a='
BB
' GROUP BY a;
SELECT DISTINCT a FROM t1 WHERE a='
BB
';
SELECT DISTINCT a FROM t1 WHERE a LIKE '
B
%
';
SELECT a FROM t1 WHERE a LIKE '
B
%
'
GROUP
BY
a
;
DROP
TABLE
t1
;
sql/opt_range.cc
View file @
2ba25676
...
@@ -7780,6 +7780,7 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
...
@@ -7780,6 +7780,7 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
quick_prefix_selectivity
=
(
double
)
quick_prefix_records
/
quick_prefix_selectivity
=
(
double
)
quick_prefix_records
/
(
double
)
table_records
;
(
double
)
table_records
;
num_groups
=
(
uint
)
rint
(
num_groups
*
quick_prefix_selectivity
);
num_groups
=
(
uint
)
rint
(
num_groups
*
quick_prefix_selectivity
);
set_if_bigger
(
num_groups
,
1
);
}
}
if
(
used_key_parts
>
group_key_parts
)
if
(
used_key_parts
>
group_key_parts
)
...
...
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