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
ef2a4f11
Commit
ef2a4f11
authored
Sep 14, 2011
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
3fb22ac5
5ebff8ab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
9 deletions
+105
-9
mysql-test/r/myisam_mrr.result
mysql-test/r/myisam_mrr.result
+40
-1
mysql-test/t/myisam_mrr.test
mysql-test/t/myisam_mrr.test
+42
-1
sql/item.cc
sql/item.cc
+15
-0
sql/multi_range_read.cc
sql/multi_range_read.cc
+8
-7
No files found.
mysql-test/r/myisam_mrr.result
View file @
ef2a4f11
...
...
@@ -509,5 +509,44 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE table3 ref PRIMARY,col_varchar_key col_varchar_key 3 test.table2.col_varchar_key 3 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
set join_cache_level= @save_join_cache_level;
set join_buffer_size= @save_join_buffer_size;
set optimizer_switch= @myisam_mrr_tmp;
drop table t1;
#
# BUG#730133: Wrong result with jkl = 7, BKA, ICP in maria-5.3 + compound index
#
set @tmp_730133_jcl= @@join_cache_level;
set join_cache_level = 7;
set @tmp_730133_os= @@optimizer_switch;
set optimizer_switch= 'join_cache_hashed=off,join_cache_bka=on,index_condition_pushdown=on,optimize_join_buffer_size=on';
CREATE TABLE t1 (f1 int, f2 int, f3 int, f4 int, f5 int, KEY (f4,f3));
INSERT IGNORE INTO t1 VALUES ('2','9','5','0','0'),('4','7','0','0','0'),
('6','97','190','0','0'),('7','3','6','0','0'),('11','101','186','0','0'),
('14','194','226','0','0'),('15','148','133','0','0'),
('16','9','6','0','0'),('17','9','3','0','0'),('18','1','8','0','0'),
('19','1','5','0','0'),('20','5','7','0','0');
explain
SELECT COUNT(alias2.f2)
FROM
t1 STRAIGHT_JOIN
t1 AS alias3 STRAIGHT_JOIN
t1 AS alias2 FORCE KEY (f4)
WHERE
alias2.f4=alias3.f5 AND
alias2.f3 > alias3.f1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL f4 10 NULL 12 Using index
1 SIMPLE alias3 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join)
1 SIMPLE alias2 ref f4 f4 5 test.alias3.f5 2 Using index condition(BKA); Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
SELECT COUNT(alias2.f2)
FROM
t1 STRAIGHT_JOIN
t1 AS alias3 STRAIGHT_JOIN
t1 AS alias2 FORCE KEY (f4)
WHERE
alias2.f4=alias3.f5 AND
alias2.f3 > alias3.f1;
COUNT(alias2.f2)
768
set @@join_cache_level= @tmp_730133_jcl;
set @@optimizer_switch= @tmp_730133_os;
drop table t1;
set optimizer_switch= @myisam_mrr_tmp;
mysql-test/t/myisam_mrr.test
View file @
ef2a4f11
...
...
@@ -218,6 +218,47 @@ where
set
join_cache_level
=
@
save_join_cache_level
;
set
join_buffer_size
=
@
save_join_buffer_size
;
set
optimizer_switch
=
@
myisam_mrr_tmp
;
drop
table
t1
;
--
echo
#
--
echo
# BUG#730133: Wrong result with jkl = 7, BKA, ICP in maria-5.3 + compound index
--
echo
#
set
@
tmp_730133_jcl
=
@@
join_cache_level
;
set
join_cache_level
=
7
;
set
@
tmp_730133_os
=
@@
optimizer_switch
;
set
optimizer_switch
=
'join_cache_hashed=off,join_cache_bka=on,index_condition_pushdown=on,optimize_join_buffer_size=on'
;
CREATE
TABLE
t1
(
f1
int
,
f2
int
,
f3
int
,
f4
int
,
f5
int
,
KEY
(
f4
,
f3
));
INSERT
IGNORE
INTO
t1
VALUES
(
'2'
,
'9'
,
'5'
,
'0'
,
'0'
),(
'4'
,
'7'
,
'0'
,
'0'
,
'0'
),
(
'6'
,
'97'
,
'190'
,
'0'
,
'0'
),(
'7'
,
'3'
,
'6'
,
'0'
,
'0'
),(
'11'
,
'101'
,
'186'
,
'0'
,
'0'
),
(
'14'
,
'194'
,
'226'
,
'0'
,
'0'
),(
'15'
,
'148'
,
'133'
,
'0'
,
'0'
),
(
'16'
,
'9'
,
'6'
,
'0'
,
'0'
),(
'17'
,
'9'
,
'3'
,
'0'
,
'0'
),(
'18'
,
'1'
,
'8'
,
'0'
,
'0'
),
(
'19'
,
'1'
,
'5'
,
'0'
,
'0'
),(
'20'
,
'5'
,
'7'
,
'0'
,
'0'
);
explain
SELECT
COUNT
(
alias2
.
f2
)
FROM
t1
STRAIGHT_JOIN
t1
AS
alias3
STRAIGHT_JOIN
t1
AS
alias2
FORCE
KEY
(
f4
)
WHERE
alias2
.
f4
=
alias3
.
f5
AND
alias2
.
f3
>
alias3
.
f1
;
SELECT
COUNT
(
alias2
.
f2
)
FROM
t1
STRAIGHT_JOIN
t1
AS
alias3
STRAIGHT_JOIN
t1
AS
alias2
FORCE
KEY
(
f4
)
WHERE
alias2
.
f4
=
alias3
.
f5
AND
alias2
.
f3
>
alias3
.
f1
;
set
@@
join_cache_level
=
@
tmp_730133_jcl
;
set
@@
optimizer_switch
=
@
tmp_730133_os
;
drop
table
t1
;
## This must be last line in the file:
set
optimizer_switch
=
@
myisam_mrr_tmp
;
sql/item.cc
View file @
ef2a4f11
...
...
@@ -9124,7 +9124,22 @@ table_map Item_ref_null_helper::used_tables() const
}
/* Debugger help function */
static
char
dbug_item_print_buf
[
256
];
const
char
*
dbug_print_item
(
Item
*
item
)
{
char
*
buf
=
dbug_item_print_buf
;
String
str
(
buf
,
sizeof
(
dbug_item_print_buf
),
&
my_charset_bin
);
str
.
length
(
0
);
if
(
!
item
)
return
"(Item*)NULL"
;
item
->
print
(
&
str
,
QT_ORDINARY
);
if
(
str
.
c_ptr
()
==
buf
)
return
buf
;
else
return
"Couldn't fit into buffer"
;
}
/*****************************************************************************
** Instantiate templates
*****************************************************************************/
...
...
sql/multi_range_read.cc
View file @
ef2a4f11
...
...
@@ -424,10 +424,10 @@ void Mrr_ordered_index_reader::interrupt_read()
{
DBUG_ASSERT
(
support_scan_interruptions
);
TABLE
*
table
=
file
->
get_table
();
KEY
*
used_index
=
&
table
->
key_info
[
file
->
active_index
];
/* Save the current key value */
key_copy
(
saved_key_tuple
,
table
->
record
[
0
],
&
table
->
key_info
[
file
->
active_index
],
keypar
.
key_tuple_length
);
used_index
,
used_index
->
key_length
);
if
(
saved_primary_key
)
{
...
...
@@ -452,9 +452,9 @@ void Mrr_ordered_index_reader::position()
void
Mrr_ordered_index_reader
::
resume_read
()
{
TABLE
*
table
=
file
->
get_table
();
KEY
*
used_index
=
&
table
->
key_info
[
file
->
active_index
];
key_restore
(
table
->
record
[
0
],
saved_key_tuple
,
&
table
->
key_info
[
file
->
active_index
],
keypar
.
key_tuple_length
);
used_index
,
used_index
->
key_length
);
if
(
saved_primary_key
)
{
key_restore
(
table
->
record
[
0
],
saved_primary_key
,
...
...
@@ -531,7 +531,7 @@ int Mrr_ordered_index_reader::init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
mrr_funcs
=
*
seq_funcs
;
source_exhausted
=
FALSE
;
if
(
support_scan_interruptions
)
bzero
(
saved_key_tuple
,
key
par
.
key_tuple
_length
);
bzero
(
saved_key_tuple
,
key
_info
->
key
_length
);
have_saved_rowid
=
FALSE
;
return
0
;
}
...
...
@@ -850,10 +850,11 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
uint
pk
=
h_idx
->
get_table
()
->
s
->
primary_key
;
saved_pk_length
=
h_idx
->
get_table
()
->
key_info
[
pk
].
key_length
;
}
KEY
*
used_index
=
&
h_idx
->
get_table
()
->
key_info
[
h_idx
->
active_index
];
if
(
reader_factory
.
ordered_index_reader
.
set_interruption_temp_buffer
(
primary_file
->
ref_length
,
keypar
.
key_tuple
_length
,
used_index
->
key
_length
,
saved_pk_length
,
&
full_buf
,
full_buf_end
))
goto
use_default_impl
;
...
...
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