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
da416060
Commit
da416060
authored
Jun 24, 2007
by
igor@olga.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug25602
parents
684d0ced
59b9077c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
2 deletions
+49
-2
mysql-test/r/group_min_max.result
mysql-test/r/group_min_max.result
+21
-0
mysql-test/t/group_min_max.test
mysql-test/t/group_min_max.test
+22
-0
sql/sql_select.cc
sql/sql_select.cc
+6
-2
No files found.
mysql-test/r/group_min_max.result
View file @
da416060
...
...
@@ -2286,3 +2286,24 @@ Variable_name Value
Handler_read_key 8
Handler_read_next 1
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (a int, INDEX idx(a));
INSERT INTO t1 VALUES
(4), (2), (1), (2), (4), (2), (1), (4),
(4), (2), (1), (2), (2), (4), (1), (4);
EXPLAIN SELECT DISTINCT(a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by
SELECT DISTINCT(a) FROM t1;
a
1
2
4
EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by
SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
a
1
2
4
DROP TABLE t1;
mysql-test/t/group_min_max.test
View file @
da416060
...
...
@@ -870,3 +870,25 @@ DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
SHOW
STATUS
LIKE
'handler_read__e%'
;
DROP
TABLE
t1
,
t2
,
t3
;
#
# Bug#25602: queries with DISTINCT and SQL_BIG_RESULT hint
# for which loose scan optimization is applied
#
CREATE
TABLE
t1
(
a
int
,
INDEX
idx
(
a
));
INSERT
INTO
t1
VALUES
(
4
),
(
2
),
(
1
),
(
2
),
(
4
),
(
2
),
(
1
),
(
4
),
(
4
),
(
2
),
(
1
),
(
2
),
(
2
),
(
4
),
(
1
),
(
4
);
EXPLAIN
SELECT
DISTINCT
(
a
)
FROM
t1
;
SELECT
DISTINCT
(
a
)
FROM
t1
;
EXPLAIN
SELECT
SQL_BIG_RESULT
DISTINCT
(
a
)
FROM
t1
;
SELECT
SQL_BIG_RESULT
DISTINCT
(
a
)
FROM
t1
;
DROP
TABLE
t1
;
sql/sql_select.cc
View file @
da416060
...
...
@@ -12551,10 +12551,14 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
/*
When there is SQL_BIG_RESULT do not sort using index for GROUP BY,
and thus force sorting on disk.
and thus force sorting on disk unless a group min-max optimization
is going to be used as it is applied now only for one table queries
with covering indexes.
*/
if
((
order
!=
join
->
group_list
||
!
(
join
->
select_options
&
SELECT_BIG_RESULT
))
&&
!
(
join
->
select_options
&
SELECT_BIG_RESULT
)
||
select
&&
select
->
quick
&&
select
->
quick
->
get_type
()
==
QUICK_SELECT_I
::
QS_TYPE_GROUP_MIN_MAX
)
&&
test_if_skip_sort_order
(
tab
,
order
,
select_limit
,
0
))
DBUG_RETURN
(
0
);
for
(
ORDER
*
ord
=
join
->
order
;
ord
;
ord
=
ord
->
next
)
...
...
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