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
46fe4318
Commit
46fe4318
authored
Nov 11, 2010
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
47b0f369
d9bbc640
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
6 deletions
+90
-6
mysql-test/r/join_cache.result
mysql-test/r/join_cache.result
+40
-1
mysql-test/t/join_cache.test
mysql-test/t/join_cache.test
+33
-1
sql/field_conv.cc
sql/field_conv.cc
+17
-4
No files found.
mysql-test/r/join_cache.result
View file @
46fe4318
...
@@ -5675,7 +5675,6 @@ f 5
...
@@ -5675,7 +5675,6 @@ f 5
f 5
f 5
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_cache_level = DEFAULT;
DROP TABLE t1,t2;
DROP TABLE t1,t2;
#
# Bug #672497: 3 way join with tiny incremental join buffer with
# Bug #672497: 3 way join with tiny incremental join buffer with
# and a ref access from the first table
# and a ref access from the first table
#
#
...
@@ -5730,4 +5729,44 @@ i
...
@@ -5730,4 +5729,44 @@ i
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_cache_level = DEFAULT;
SET SESSION join_buffer_size = DEFAULT;
SET SESSION join_buffer_size = DEFAULT;
DROP TABLE t1,t2,t3;
DROP TABLE t1,t2,t3;
#
# Bug #672551: hash join over a long varchar field
#
CREATE TABLE t1 (
pk int PRIMARY KEY,
a varchar(512) CHARSET latin1 COLLATE latin1_bin DEFAULT NULL,
INDEX idx (a)
);
INSERT INTO t1 VALUES (2, 'aa'), (5, 'ccccccc'), (3, 'bb');
CREATE TABLE t2(
pk int PRIMARY KEY,
a varchar(512) CHARSET latin1 COLLATE latin1_bin DEFAULT NULL,
INDEX idx (a)
);
INSERT INTO t2 VALUES
(10, 'a'), (20, 'c'), (30, 'aa'), (4, 'bb'),
(11, 'a'), (21, 'c'), (31, 'aa'), (41, 'cc'),
(12, 'a'), (22, 'c'), (32, 'bb'), (42, 'aa');
SELECT * FROM t1,t2 WHERE t2.a=t1.a;
pk a pk a
2 aa 30 aa
2 aa 31 aa
2 aa 42 aa
3 bb 4 bb
3 bb 32 bb
SET SESSION join_cache_level = 4;
EXPLAIN
SELECT * FROM t1,t2 WHERE t2.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL idx NULL NULL NULL 3 Using where
1 SIMPLE t2 ref idx idx 515 test.t1.a 2 Using join buffer (flat, BNLH join)
SELECT * FROM t1,t2 WHERE t2.a=t1.a;
pk a pk a
2 aa 30 aa
3 bb 4 bb
2 aa 31 aa
3 bb 32 bb
2 aa 42 aa
SET SESSION join_cache_level = DEFAULT;
DROP TABLE t1,t2;
set @@optimizer_switch=@save_optimizer_switch;
set @@optimizer_switch=@save_optimizer_switch;
mysql-test/t/join_cache.test
View file @
46fe4318
...
@@ -2358,7 +2358,7 @@ SET SESSION join_cache_level = DEFAULT;
...
@@ -2358,7 +2358,7 @@ SET SESSION join_cache_level = DEFAULT;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
#
--echo #
--
echo
# Bug #672497: 3 way join with tiny incremental join buffer with
--
echo
# Bug #672497: 3 way join with tiny incremental join buffer with
--
echo
# and a ref access from the first table
--
echo
# and a ref access from the first table
--
echo
#
--
echo
#
...
@@ -2416,5 +2416,37 @@ SET SESSION join_buffer_size = DEFAULT;
...
@@ -2416,5 +2416,37 @@ SET SESSION join_buffer_size = DEFAULT;
DROP
TABLE
t1
,
t2
,
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# Bug #672551: hash join over a long varchar field
--
echo
#
CREATE
TABLE
t1
(
pk
int
PRIMARY
KEY
,
a
varchar
(
512
)
CHARSET
latin1
COLLATE
latin1_bin
DEFAULT
NULL
,
INDEX
idx
(
a
)
);
INSERT
INTO
t1
VALUES
(
2
,
'aa'
),
(
5
,
'ccccccc'
),
(
3
,
'bb'
);
CREATE
TABLE
t2
(
pk
int
PRIMARY
KEY
,
a
varchar
(
512
)
CHARSET
latin1
COLLATE
latin1_bin
DEFAULT
NULL
,
INDEX
idx
(
a
)
);
INSERT
INTO
t2
VALUES
(
10
,
'a'
),
(
20
,
'c'
),
(
30
,
'aa'
),
(
4
,
'bb'
),
(
11
,
'a'
),
(
21
,
'c'
),
(
31
,
'aa'
),
(
41
,
'cc'
),
(
12
,
'a'
),
(
22
,
'c'
),
(
32
,
'bb'
),
(
42
,
'aa'
);
SELECT
*
FROM
t1
,
t2
WHERE
t2
.
a
=
t1
.
a
;
SET
SESSION
join_cache_level
=
4
;
EXPLAIN
SELECT
*
FROM
t1
,
t2
WHERE
t2
.
a
=
t1
.
a
;
SELECT
*
FROM
t1
,
t2
WHERE
t2
.
a
=
t1
.
a
;
SET
SESSION
join_cache_level
=
DEFAULT
;
DROP
TABLE
t1
,
t2
;
# this must be the last command in the file
# this must be the last command in the file
set
@@
optimizer_switch
=@
save_optimizer_switch
;
set
@@
optimizer_switch
=@
save_optimizer_switch
;
sql/field_conv.cc
View file @
46fe4318
...
@@ -449,7 +449,8 @@ static void do_varstring1(Copy_field *copy)
...
@@ -449,7 +449,8 @@ static void do_varstring1(Copy_field *copy)
if
(
length
>
copy
->
to_length
-
1
)
if
(
length
>
copy
->
to_length
-
1
)
{
{
length
=
copy
->
to_length
-
1
;
length
=
copy
->
to_length
-
1
;
if
(
copy
->
from_field
->
table
->
in_use
->
count_cuted_fields
)
if
(
copy
->
from_field
->
table
->
in_use
->
count_cuted_fields
&&
copy
->
to_field
)
copy
->
to_field
->
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
copy
->
to_field
->
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
1
);
WARN_DATA_TRUNCATED
,
1
);
}
}
...
@@ -485,7 +486,8 @@ static void do_varstring2(Copy_field *copy)
...
@@ -485,7 +486,8 @@ static void do_varstring2(Copy_field *copy)
if
(
length
>
copy
->
to_length
-
HA_KEY_BLOB_LENGTH
)
if
(
length
>
copy
->
to_length
-
HA_KEY_BLOB_LENGTH
)
{
{
length
=
copy
->
to_length
-
HA_KEY_BLOB_LENGTH
;
length
=
copy
->
to_length
-
HA_KEY_BLOB_LENGTH
;
if
(
copy
->
from_field
->
table
->
in_use
->
count_cuted_fields
)
if
(
copy
->
from_field
->
table
->
in_use
->
count_cuted_fields
&&
copy
->
to_field
)
copy
->
to_field
->
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
copy
->
to_field
->
set_warning
(
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
WARN_DATA_TRUNCATED
,
1
);
WARN_DATA_TRUNCATED
,
1
);
}
}
...
@@ -549,9 +551,16 @@ void Copy_field::set(uchar *to,Field *from)
...
@@ -549,9 +551,16 @@ void Copy_field::set(uchar *to,Field *from)
do_copy
=
do_field_to_null_str
;
do_copy
=
do_field_to_null_str
;
}
}
else
else
{
{
to_null_ptr
=
0
;
// For easy debugging
to_null_ptr
=
0
;
// For easy debugging
do_copy
=
do_field_eq
;
/* Setup optimal copying for varchar */
if
(
from
->
real_type
()
==
MYSQL_TYPE_VARCHAR
)
{
do_copy
=
(((
Field_varstring
*
)
from
)
->
length_bytes
==
1
?
do_varstring1
:
do_varstring2
);
}
else
do_copy
=
do_field_eq
;
}
}
}
}
...
@@ -710,6 +719,10 @@ Copy_field::get_copy_func(Field *to,Field *from)
...
@@ -710,6 +719,10 @@ Copy_field::get_copy_func(Field *to,Field *from)
do_varstring1_mb
)
:
do_varstring1_mb
)
:
(
from
->
charset
()
->
mbmaxlen
==
1
?
do_varstring2
:
(
from
->
charset
()
->
mbmaxlen
==
1
?
do_varstring2
:
do_varstring2_mb
));
do_varstring2_mb
));
else
return
(((
Field_varstring
*
)
from
)
->
length_bytes
==
1
?
do_varstring1
:
do_varstring2
);
}
}
else
if
(
to_length
<
from_length
)
else
if
(
to_length
<
from_length
)
return
(
from
->
charset
()
->
mbmaxlen
==
1
?
return
(
from
->
charset
()
->
mbmaxlen
==
1
?
...
...
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