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
5367793e
Commit
5367793e
authored
Oct 09, 2006
by
gkodinov/kgeorge@macbook.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.0-opt
into macbook.local:/Users/kgeorge/mysql/work/B22781-5.0-opt
parents
1f8057a6
13633864
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
183 additions
and
57 deletions
+183
-57
mysql-test/r/bdb.result
mysql-test/r/bdb.result
+36
-36
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+65
-2
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+8
-8
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+16
-0
mysql-test/r/myisam.result
mysql-test/r/myisam.result
+8
-8
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+22
-0
mysql-test/t/innodb_mysql.test
mysql-test/t/innodb_mysql.test
+18
-0
sql/sql_select.cc
sql/sql_select.cc
+10
-3
No files found.
mysql-test/r/bdb.result
View file @
5367793e
...
...
@@ -1509,27 +1509,27 @@ i 10
select sql_big_result v,count(t) from t1 group by v limit 10;
v count(t)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
a
10
b
10
c
10
d
10
e
10
f
10
g
10
h
10
i
10
select sql_big_result v,count(c) from t1 group by v limit 10;
v count(c)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
a
10
b
10
c
10
d
10
e
10
f
10
g
10
h
10
i
10
select c,count(*) from t1 group by c limit 10;
c count(*)
a 1
...
...
@@ -1673,15 +1673,15 @@ i 10
select sql_big_result v,count(t) from t1 group by v limit 10;
v count(t)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
a
10
b
10
c
10
d
10
e
10
f
10
g
10
h
10
i
10
alter table t1 drop key v, add key v (v(30));
show create table t1;
Table Create Table
...
...
@@ -1800,15 +1800,15 @@ i 10
select sql_big_result v,count(t) from t1 group by v limit 10;
v count(t)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
h 10
i 10
a
10
b
10
c
10
d
10
e
10
f
10
g
10
h
10
i
10
drop table t1;
create table t1 (a char(10), unique (a));
insert into t1 values ('a ');
...
...
mysql-test/r/group_by.result
View file @
5367793e
...
...
@@ -303,10 +303,10 @@ spid sum(userid)
1 1
explain select sql_big_result score,count(*) from t1 group by score desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL score 3 NULL 8 Using index
1 SIMPLE t1 index NULL score 3 NULL 8 Using index
; Using filesort
explain select sql_big_result score,count(*) from t1 group by score desc order by null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL score 3 NULL 8 Using index
1 SIMPLE t1 index NULL score 3 NULL 8 Using index
; Using filesort
select sql_big_result score,count(*) from t1 group by score desc;
score count(*)
3 5
...
...
@@ -821,3 +821,66 @@ a b real_b
68 France France
DROP VIEW v1;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, key (b));
INSERT INTO t1 VALUES (1, 1);
INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20) FROM t1;
INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20) FROM t1;
INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20) FROM t1;
INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20) FROM t1;
INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20) FROM t1;
INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20) FROM t1;
INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20) FROM t1;
SELECT MIN(b), MAX(b) from t1;
MIN(b) MAX(b)
0 19
EXPLAIN SELECT b, sum(1) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 128 Using index
EXPLAIN SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 128 Using index; Using filesort
SELECT b, sum(1) FROM t1 GROUP BY b;
b sum(1)
0 6
1 7
2 7
3 7
4 7
5 7
6 7
7 7
8 7
9 6
10 6
11 6
12 6
13 6
14 6
15 6
16 6
17 6
18 6
19 6
SELECT SQL_BIG_RESULT b, sum(1) FROM t1 GROUP BY b;
b sum(1)
0 6
1 7
2 7
3 7
4 7
5 7
6 7
7 7
8 7
9 6
10 6
11 6
12 6
13 6
14 6
15 6
16 6
17 6
18 6
19 6
DROP TABLE t1;
mysql-test/r/innodb.result
View file @
5367793e
...
...
@@ -2070,15 +2070,15 @@ i 10
select sql_big_result v,count(c) from t1 group by v limit 10;
v count(c)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
a
10
b
10
c
10
d
10
e
10
f
10
g
10
h 10
i 10
i
10
select c,count(*) from t1 group by c limit 10;
c count(*)
a 1
...
...
mysql-test/r/innodb_mysql.result
View file @
5367793e
...
...
@@ -337,3 +337,19 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index NULL fkey 5 NULL 5 Using index
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.fkey 1 Using where
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c FLOAT, KEY b(b)) ENGINE = INNODB;
INSERT INTO t1 VALUES ( 1 , 1 , 1);
INSERT INTO t1 SELECT a + 1 , MOD(a + 1 , 20), 1 FROM t1;
INSERT INTO t1 SELECT a + 2 , MOD(a + 2 , 20), 1 FROM t1;
INSERT INTO t1 SELECT a + 4 , MOD(a + 4 , 20), 1 FROM t1;
INSERT INTO t1 SELECT a + 8 , MOD(a + 8 , 20), 1 FROM t1;
INSERT INTO t1 SELECT a + 16, MOD(a + 16, 20), 1 FROM t1;
INSERT INTO t1 SELECT a + 32, MOD(a + 32, 20), 1 FROM t1;
INSERT INTO t1 SELECT a + 64, MOD(a + 64, 20), 1 FROM t1;
EXPLAIN SELECT b, SUM(c) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 128
EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort
DROP TABLE t1;
mysql-test/r/myisam.result
View file @
5367793e
...
...
@@ -1002,15 +1002,15 @@ i 10
select sql_big_result v,count(c) from t1 group by v limit 10;
v count(c)
a 1
a 10
b 10
c 10
d 10
e 10
f 10
g 10
a
10
b
10
c
10
d
10
e
10
f
10
g
10
h 10
i 10
i
10
select c,count(*) from t1 group by c limit 10;
c count(*)
a 1
...
...
mysql-test/t/group_by.test
View file @
5367793e
...
...
@@ -655,3 +655,25 @@ where t2.b=v1.a GROUP BY t2.b;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
#
# Bug#22781: SQL_BIG_RESULT fails to influence sort plan
#
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
,
b
INT
,
key
(
b
));
INSERT
INTO
t1
VALUES
(
1
,
1
);
INSERT
INTO
t1
SELECT
a
+
1
,
MOD
(
a
+
1
,
20
)
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
2
,
MOD
(
a
+
2
,
20
)
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
4
,
MOD
(
a
+
4
,
20
)
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
8
,
MOD
(
a
+
8
,
20
)
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
16
,
MOD
(
a
+
16
,
20
)
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
32
,
MOD
(
a
+
32
,
20
)
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
64
,
MOD
(
a
+
64
,
20
)
FROM
t1
;
SELECT
MIN
(
b
),
MAX
(
b
)
from
t1
;
EXPLAIN
SELECT
b
,
sum
(
1
)
FROM
t1
GROUP
BY
b
;
EXPLAIN
SELECT
SQL_BIG_RESULT
b
,
sum
(
1
)
FROM
t1
GROUP
BY
b
;
SELECT
b
,
sum
(
1
)
FROM
t1
GROUP
BY
b
;
SELECT
SQL_BIG_RESULT
b
,
sum
(
1
)
FROM
t1
GROUP
BY
b
;
DROP
TABLE
t1
;
mysql-test/t/innodb_mysql.test
View file @
5367793e
...
...
@@ -302,3 +302,21 @@ SELECT COUNT(*) FROM t2 LEFT JOIN t1 ON t2.fkey = t1.id
WHERE
t1
.
name
LIKE
'A%'
OR
FALSE
;
DROP
TABLE
t1
,
t2
;
#
# Bug#22781: SQL_BIG_RESULT fails to influence sort plan
#
CREATE
TABLE
t1
(
a
INT
PRIMARY
KEY
,
b
INT
,
c
FLOAT
,
KEY
b
(
b
))
ENGINE
=
INNODB
;
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
);
INSERT
INTO
t1
SELECT
a
+
1
,
MOD
(
a
+
1
,
20
),
1
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
2
,
MOD
(
a
+
2
,
20
),
1
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
4
,
MOD
(
a
+
4
,
20
),
1
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
8
,
MOD
(
a
+
8
,
20
),
1
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
16
,
MOD
(
a
+
16
,
20
),
1
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
32
,
MOD
(
a
+
32
,
20
),
1
FROM
t1
;
INSERT
INTO
t1
SELECT
a
+
64
,
MOD
(
a
+
64
,
20
),
1
FROM
t1
;
EXPLAIN
SELECT
b
,
SUM
(
c
)
FROM
t1
GROUP
BY
b
;
EXPLAIN
SELECT
SQL_BIG_RESULT
b
,
SUM
(
c
)
FROM
t1
GROUP
BY
b
;
DROP
TABLE
t1
;
sql/sql_select.cc
View file @
5367793e
...
...
@@ -1399,7 +1399,8 @@ JOIN::exec()
simple_order
=
simple_group
;
skip_sort_order
=
0
;
}
if
(
order
&&
if
(
order
&&
(
order
!=
group_list
||
!
(
select_options
&
SELECT_BIG_RESULT
))
&&
(
const_tables
==
tables
||
((
simple_order
||
skip_sort_order
)
&&
test_if_skip_sort_order
(
&
join_tab
[
const_tables
],
order
,
...
...
@@ -11995,11 +11996,17 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
table
=
tab
->
table
;
select
=
tab
->
select
;
if
(
test_if_skip_sort_order
(
tab
,
order
,
select_limit
,
0
))
/*
When there is SQL_BIG_RESULT do not sort using index for GROUP BY,
and thus force sorting on disk.
*/
if
((
order
!=
join
->
group_list
||
!
(
join
->
select_options
&
SELECT_BIG_RESULT
))
&&
test_if_skip_sort_order
(
tab
,
order
,
select_limit
,
0
))
DBUG_RETURN
(
0
);
if
(
!
(
sortorder
=
make_unireg_sortorder
(
order
,
&
length
)))
goto
err
;
/* purecov: inspected */
/* It's not fatal if the following alloc fails */
table
->
sort
.
io_cache
=
(
IO_CACHE
*
)
my_malloc
(
sizeof
(
IO_CACHE
),
MYF
(
MY_WME
|
MY_ZEROFILL
));
table
->
status
=
0
;
// May be wrong if quick_select
...
...
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