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
ed240578
Commit
ed240578
authored
Jan 06, 2011
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Fixed vargrind problems in check_join_cache_usage().
Merged the patch for bug 697557. Adjusted the results.
parents
85523738
cb4fa7f4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
23 deletions
+47
-23
mysql-test/r/join_cache.result
mysql-test/r/join_cache.result
+20
-0
mysql-test/t/join_cache.test
mysql-test/t/join_cache.test
+22
-0
sql/key.cc
sql/key.cc
+2
-20
sql/sql_select.cc
sql/sql_select.cc
+3
-3
No files found.
mysql-test/r/join_cache.result
View file @
ed240578
...
...
@@ -6952,4 +6952,24 @@ a a b
2 NULL 42
SET SESSION join_cache_level = DEFAULT;
DROP TABLE t1,t2;
#
# Bug #697557: hash join on a varchar field
#
CREATE TABLE t1 ( f1 varchar(10) , f2 int(11) , KEY (f1));
INSERT INTO t1 VALUES ('r',1), ('m',2);
CREATE TABLE t2 ( f1 varchar(10) , f2 int(11) , KEY (f1));
INSERT INTO t2 VALUES
('hgtofubn',1), ('GDOXZ',91), ('n',2), ('fggxgalh',88),
('hgtofu',1), ('GDO',101), ('n',3), ('fggxga',55),
('hgtofu',3), ('GDO',33), ('nn',3), ('fggxgarrr',77);
SET SESSION join_cache_level=3;
EXPLAIN
SELECT * FROM t1,t2 WHERE t2.f1 = t1.f1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL f1 NULL NULL NULL 2 Using where
1 SIMPLE t2 hash f1 f1 13 test.t1.f1 12 Using join buffer (flat, BNLH join)
SELECT * FROM t1,t2 WHERE t2.f1 = t1.f1;
f1 f2 f1 f2
SET SESSION join_cache_level = DEFAULT;
DROP TABLE t1,t2;
set @@optimizer_switch=@save_optimizer_switch;
mysql-test/t/join_cache.test
View file @
ed240578
...
...
@@ -2931,6 +2931,28 @@ SET SESSION join_cache_level = DEFAULT;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# Bug #697557: hash join on a varchar field
--
echo
#
CREATE
TABLE
t1
(
f1
varchar
(
10
)
,
f2
int
(
11
)
,
KEY
(
f1
));
INSERT
INTO
t1
VALUES
(
'r'
,
1
),
(
'm'
,
2
);
CREATE
TABLE
t2
(
f1
varchar
(
10
)
,
f2
int
(
11
)
,
KEY
(
f1
));
INSERT
INTO
t2
VALUES
(
'hgtofubn'
,
1
),
(
'GDOXZ'
,
91
),
(
'n'
,
2
),
(
'fggxgalh'
,
88
),
(
'hgtofu'
,
1
),
(
'GDO'
,
101
),
(
'n'
,
3
),
(
'fggxga'
,
55
),
(
'hgtofu'
,
3
),
(
'GDO'
,
33
),
(
'nn'
,
3
),
(
'fggxgarrr'
,
77
);
SET
SESSION
join_cache_level
=
3
;
EXPLAIN
SELECT
*
FROM
t1
,
t2
WHERE
t2
.
f1
=
t1
.
f1
;
SELECT
*
FROM
t1
,
t2
WHERE
t2
.
f1
=
t1
.
f1
;
SET
SESSION
join_cache_level
=
DEFAULT
;
DROP
TABLE
t1
,
t2
;
# this must be the last command in the file
set
@@
optimizer_switch
=@
save_optimizer_switch
;
sql/key.cc
View file @
ed240578
...
...
@@ -689,20 +689,12 @@ ulong key_hashnr(KEY *key_info, uint used_key_parts, const uchar *key)
pack_length
=
0
;
break
;
case
HA_KEYTYPE_VARTEXT1
:
cs
=
key_part
->
field
->
charset
();
length
=
(
uint
)(
pos
[
0
]);
pack_length
=
1
;
break
;
case
HA_KEYTYPE_VARBINARY1
:
cs
=
&
my_charset_bin
;
length
=
(
uint
)(
pos
[
0
]);
pack_length
=
1
;
break
;
case
HA_KEYTYPE_VARTEXT2
:
cs
=
key_part
->
field
->
charset
();
length
=
uint2korr
(
pos
);
pack_length
=
2
;
break
;
case
HA_KEYTYPE_VARBINARY1
:
case
HA_KEYTYPE_VARBINARY2
:
cs
=
&
my_charset_bin
;
length
=
uint2korr
(
pos
);
...
...
@@ -806,23 +798,13 @@ bool key_buf_cmp(KEY *key_info, uint used_key_parts,
pack_length
=
0
;
break
;
case
HA_KEYTYPE_VARTEXT1
:
cs
=
key_part
->
field
->
charset
();
length1
=
(
uint
)(
pos1
[
0
]);
length2
=
(
uint
)(
pos2
[
0
]);
pack_length
=
1
;
break
;
case
HA_KEYTYPE_VARBINARY1
:
cs
=
&
my_charset_bin
;
length1
=
(
uint
)(
pos1
[
0
]);
length2
=
(
uint
)(
pos2
[
0
]);
pack_length
=
1
;
break
;
case
HA_KEYTYPE_VARTEXT2
:
cs
=
key_part
->
field
->
charset
();
length1
=
uint2korr
(
pos1
);
length2
=
uint2korr
(
pos2
);
pack_length
=
2
;
break
;
case
HA_KEYTYPE_VARBINARY1
:
case
HA_KEYTYPE_VARBINARY2
:
cs
=
&
my_charset_bin
;
length1
=
uint2korr
(
pos1
);
...
...
sql/sql_select.cc
View file @
ed240578
...
...
@@ -7877,8 +7877,8 @@ uint check_join_cache_usage(JOIN_TAB *tab,
bool
*
icp_other_tables_ok
,
bool
*
idx_cond_fact_out
)
{
uint
flags
;
COST_VECT
cost
;
uint
flags
=
0
;
ha_rows
rows
=
0
;
uint
bufsz
=
4096
;
JOIN_CACHE
*
prev_cache
=
0
;
...
...
@@ -7996,8 +7996,8 @@ uint check_join_cache_usage(JOIN_TAB *tab,
}
if
((
cache_level
<=
4
&&
!
no_hashed_cache
)
||
no_bka_cache
||
((
flags
&
HA_MRR_NO_ASSOCIATION
)
&&
cache_level
<=
6
)
||
tab
->
is_ref_for_hash_join
(
))
tab
->
is_ref_for_hash_join
()
||
((
flags
&
HA_MRR_NO_ASSOCIATION
)
&&
cache_level
<=
6
))
{
if
(
!
tab
->
hash_join_is_possible
()
||
tab
->
make_scan_filter
())
...
...
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