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
f83cc507
Commit
f83cc507
authored
Sep 01, 2010
by
Igor Babaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed an incorrect calculation of JOIN_CACHE::max_buff_size.
parent
5dec6cca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
6 deletions
+25
-6
mysql-test/r/subselect_sj_jcl6.result
mysql-test/r/subselect_sj_jcl6.result
+2
-2
sql/sql_join_cache.cc
sql/sql_join_cache.cc
+6
-3
sql/sql_select.cc
sql/sql_select.cc
+13
-0
sql/sql_select.h
sql/sql_select.h
+4
-1
No files found.
mysql-test/r/subselect_sj_jcl6.result
100755 → 100644
View file @
f83cc507
...
@@ -723,7 +723,6 @@ WHERE int_nokey IN (SELECT it2.int_key
...
@@ -723,7 +723,6 @@ WHERE int_nokey IN (SELECT it2.int_key
FROM it1 LEFT JOIN it2 ON it2.datetime_key);
FROM it1 LEFT JOIN it2 ON it2.datetime_key);
int_key
int_key
0
0
8
2
2
0
0
7
7
...
@@ -734,10 +733,11 @@ int_key
...
@@ -734,10 +733,11 @@ int_key
0
0
0
0
0
0
0
3
3
7
7
7
7
8
0
5
5
EXPLAIN
EXPLAIN
SELECT int_key FROM ot1
SELECT int_key FROM ot1
...
...
sql/sql_join_cache.cc
View file @
f83cc507
...
@@ -747,7 +747,7 @@ ulong JOIN_CACHE::get_max_join_buffer_size()
...
@@ -747,7 +747,7 @@ ulong JOIN_CACHE::get_max_join_buffer_size()
if
(
join_tab
->
join_buffer_size_limit
)
if
(
join_tab
->
join_buffer_size_limit
)
set_if_smaller
(
limit_sz
,
join_tab
->
join_buffer_size_limit
);
set_if_smaller
(
limit_sz
,
join_tab
->
join_buffer_size_limit
);
if
(
limit_sz
/
max_records
>
space_per_record
)
if
(
limit_sz
/
max_records
>
space_per_record
)
max_sz
*
=
space_per_record
*
max_records
;
max_sz
=
space_per_record
*
max_records
;
else
else
max_sz
=
limit_sz
;
max_sz
=
limit_sz
;
max_sz
+=
pack_length_with_blob_ptrs
;
max_sz
+=
pack_length_with_blob_ptrs
;
...
@@ -790,15 +790,18 @@ int JOIN_CACHE::alloc_buffer()
...
@@ -790,15 +790,18 @@ int JOIN_CACHE::alloc_buffer()
{
{
JOIN_TAB
*
tab
;
JOIN_TAB
*
tab
;
JOIN_CACHE
*
cache
;
JOIN_CACHE
*
cache
;
uint
i
=
join
->
const_tables
;
ulonglong
curr_buff_space_sz
=
0
;
ulonglong
curr_buff_space_sz
=
0
;
ulonglong
curr_min_buff_space_sz
=
0
;
ulonglong
curr_min_buff_space_sz
=
0
;
ulonglong
join_buff_space_limit
=
ulonglong
join_buff_space_limit
=
join
->
thd
->
variables
.
join_buff_space_limit
;
join
->
thd
->
variables
.
join_buff_space_limit
;
double
partial_join_cardinality
=
(
join_tab
-
1
)
->
get_partial_join_cardinality
();
buff
=
NULL
;
buff
=
NULL
;
min_buff_size
=
0
;
min_buff_size
=
0
;
max_buff_size
=
0
;
max_buff_size
=
0
;
min_records
=
1
;
min_records
=
1
;
max_records
=
join_tab
->
records
;
max_records
=
partial_join_cardinality
<=
join_buff_space_limit
?
(
ulonglong
)
partial_join_cardinality
:
join_buff_space_limit
;
set_if_bigger
(
max_records
,
1
);
set_if_bigger
(
max_records
,
1
);
min_buff_size
=
get_min_join_buffer_size
();
min_buff_size
=
get_min_join_buffer_size
();
buff_size
=
get_max_join_buffer_size
();
buff_size
=
get_max_join_buffer_size
();
...
...
sql/sql_select.cc
View file @
f83cc507
...
@@ -7720,6 +7720,9 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
...
@@ -7720,6 +7720,9 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
setup_semijoin_dups_elimination
(
join
,
options
,
no_jbuf_after
))
setup_semijoin_dups_elimination
(
join
,
options
,
no_jbuf_after
))
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
for
(
i
=
0
;
i
<
join
->
const_tables
;
i
++
)
join
->
join_tab
[
i
].
partial_join_cardinality
=
1
;
for
(
i
=
join
->
const_tables
;
i
<
join
->
tables
;
i
++
)
for
(
i
=
join
->
const_tables
;
i
<
join
->
tables
;
i
++
)
{
{
JOIN_TAB
*
tab
=
join
->
join_tab
+
i
;
JOIN_TAB
*
tab
=
join
->
join_tab
+
i
;
...
@@ -7731,6 +7734,16 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
...
@@ -7731,6 +7734,16 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
tab
->
next_select
=
sub_select
;
/* normal select */
tab
->
next_select
=
sub_select
;
/* normal select */
tab
->
sorted
=
sorted
;
tab
->
sorted
=
sorted
;
sorted
=
0
;
// only first must be sorted
sorted
=
0
;
// only first must be sorted
/*
The approximation below for partial join cardinality is not good because
- it does not take into account some pushdown predicates
- it does not differentiate between inner joins, outer joins and semi-joins.
Later it should be improved.
*/
tab
->
partial_join_cardinality
=
join
->
best_positions
[
i
].
records_read
*
(
i
?
(
tab
-
1
)
->
partial_join_cardinality
:
1
);
if
(
tab
->
loosescan_match_tab
)
if
(
tab
->
loosescan_match_tab
)
{
{
if
(
!
(
tab
->
loosescan_buf
=
(
uchar
*
)
join
->
thd
->
alloc
(
tab
->
if
(
!
(
tab
->
loosescan_buf
=
(
uchar
*
)
join
->
thd
->
alloc
(
tab
->
...
...
sql/sql_select.h
View file @
f83cc507
...
@@ -216,7 +216,9 @@ typedef struct st_join_table {
...
@@ -216,7 +216,9 @@ typedef struct st_join_table {
E(#records) is in found_records.
E(#records) is in found_records.
*/
*/
ha_rows
read_time
;
ha_rows
read_time
;
double
partial_join_cardinality
;
table_map
dependent
,
key_dependent
;
table_map
dependent
,
key_dependent
;
uint
use_quick
,
index
;
uint
use_quick
,
index
;
uint
status
;
///< Save status for cache
uint
status
;
///< Save status for cache
...
@@ -386,6 +388,7 @@ typedef struct st_join_table {
...
@@ -386,6 +388,7 @@ typedef struct st_join_table {
calc_used_field_length
(
TRUE
);
calc_used_field_length
(
TRUE
);
return
max_used_fieldlength
;
return
max_used_fieldlength
;
}
}
double
get_partial_join_cardinality
()
{
return
partial_join_cardinality
;
}
}
JOIN_TAB
;
}
JOIN_TAB
;
...
...
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