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
6efcad28
Commit
6efcad28
authored
Mar 19, 2011
by
Sergey Petrunya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MWL#90: Address review feedback part #1
parent
c0a60699
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
21 additions
and
44 deletions
+21
-44
mysql-test/include/mix1.inc
mysql-test/include/mix1.inc
+0
-8
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/r/innodb_mysql.result
+0
-8
mysql-test/suite/innodb_plugin/r/innodb_mysql.result
mysql-test/suite/innodb_plugin/r/innodb_mysql.result
+0
-8
sql/item_subselect.cc
sql/item_subselect.cc
+2
-2
sql/item_subselect.h
sql/item_subselect.h
+0
-5
sql/sql_join_cache.h
sql/sql_join_cache.h
+0
-2
sql/sql_select.cc
sql/sql_select.cc
+6
-4
sql/sql_select.h
sql/sql_select.h
+3
-1
sql/sql_show.cc
sql/sql_show.cc
+0
-3
sql/table.cc
sql/table.cc
+7
-0
sql/table.h
sql/table.h
+3
-3
No files found.
mysql-test/include/mix1.inc
View file @
6efcad28
...
@@ -1532,12 +1532,6 @@ INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
...
@@ -1532,12 +1532,6 @@ INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
--
echo
# MariaDB note:
--
echo
# This will show 2 for table which has 5 rows.
--
echo
# This is because the access method employed is actually range access
--
echo
# which scans 2 records (yes, EXPLAIN displays it incorrectly).
--
echo
# our correct printing is an artifact of changing in select_describe()
--
echo
# from printing table->starts.records() to tab->records.
EXPLAIN
EXPLAIN
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
...
@@ -1551,7 +1545,6 @@ INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
...
@@ -1551,7 +1545,6 @@ INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
--
echo
# See above "MariaDB note"
EXPLAIN
EXPLAIN
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
...
@@ -1566,7 +1559,6 @@ INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
...
@@ -1566,7 +1559,6 @@ INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
--
echo
# See above "MariaDB note"
EXPLAIN
EXPLAIN
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
SELECT
1
FROM
(
SELECT
COUNT
(
DISTINCT
c1
)
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
FROM
t1
WHERE
c2
IN
(
1
,
1
)
AND
c3
=
2
GROUP
BY
c2
)
x
;
...
...
mysql-test/suite/innodb/r/innodb_mysql.result
View file @
6efcad28
...
@@ -1735,12 +1735,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
...
@@ -1735,12 +1735,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
1
1
1
1
# MariaDB note:
# This will show 2 for table which has 5 rows.
# This is because the access method employed is actually range access
# which scans 2 records (yes, EXPLAIN displays it incorrectly).
# our correct printing is an artifact of changing in select_describe()
# from printing table->starts.records() to tab->records.
EXPLAIN
EXPLAIN
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
...
@@ -1755,7 +1749,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
...
@@ -1755,7 +1749,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
1
1
1
1
# See above "MariaDB note"
EXPLAIN
EXPLAIN
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
...
@@ -1771,7 +1764,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
...
@@ -1771,7 +1764,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
1
1
1
1
# See above "MariaDB note"
EXPLAIN
EXPLAIN
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
...
...
mysql-test/suite/innodb_plugin/r/innodb_mysql.result
View file @
6efcad28
...
@@ -1735,12 +1735,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
...
@@ -1735,12 +1735,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
1
1
1
1
# MariaDB note:
# This will show 2 for table which has 5 rows.
# This is because the access method employed is actually range access
# which scans 2 records (yes, EXPLAIN displays it incorrectly).
# our correct printing is an artifact of changing in select_describe()
# from printing table->starts.records() to tab->records.
EXPLAIN
EXPLAIN
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
...
@@ -1755,7 +1749,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
...
@@ -1755,7 +1749,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
1
1
1
1
# See above "MariaDB note"
EXPLAIN
EXPLAIN
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
...
@@ -1771,7 +1764,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
...
@@ -1771,7 +1764,6 @@ SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
1
1
1
1
# See above "MariaDB note"
EXPLAIN
EXPLAIN
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
...
...
sql/item_subselect.cc
View file @
6efcad28
...
@@ -1022,7 +1022,7 @@ Item_in_subselect::Item_in_subselect(Item * left_exp,
...
@@ -1022,7 +1022,7 @@ Item_in_subselect::Item_in_subselect(Item * left_exp,
st_select_lex
*
select_lex
)
:
st_select_lex
*
select_lex
)
:
Item_exists_subselect
(),
left_expr_cache
(
0
),
first_execution
(
TRUE
),
Item_exists_subselect
(),
left_expr_cache
(
0
),
first_execution
(
TRUE
),
is_constant
(
FALSE
),
optimizer
(
0
),
pushed_cond_guards
(
NULL
),
is_constant
(
FALSE
),
optimizer
(
0
),
pushed_cond_guards
(
NULL
),
exec_method
(
NOT_TRANSFORMED
),
upper_item
(
0
)
exec_method
(
NOT_TRANSFORMED
),
is_flattenable_semijoin
(
FALSE
),
upper_item
(
0
)
{
{
DBUG_ENTER
(
"Item_in_subselect::Item_in_subselect"
);
DBUG_ENTER
(
"Item_in_subselect::Item_in_subselect"
);
left_expr
=
left_exp
;
left_expr
=
left_exp
;
...
@@ -4080,7 +4080,7 @@ void subselect_hash_sj_engine::cleanup()
...
@@ -4080,7 +4080,7 @@ void subselect_hash_sj_engine::cleanup()
int
subselect_hash_sj_engine
::
optimize
()
int
subselect_hash_sj_engine
::
optimize
()
{
{
int
res
=
0
;
int
res
;
SELECT_LEX
*
save_select
=
thd
->
lex
->
current_select
;
SELECT_LEX
*
save_select
=
thd
->
lex
->
current_select
;
thd
->
lex
->
current_select
=
materialize_join
->
select_lex
;
thd
->
lex
->
current_select
=
materialize_join
->
select_lex
;
res
=
materialize_join
->
optimize
();
res
=
materialize_join
->
optimize
();
...
...
sql/item_subselect.h
View file @
6efcad28
...
@@ -406,11 +406,6 @@ class Item_in_subselect :public Item_exists_subselect
...
@@ -406,11 +406,6 @@ class Item_in_subselect :public Item_exists_subselect
*/
*/
bool
is_flattenable_semijoin
;
bool
is_flattenable_semijoin
;
/*
Cost to populate the temporary table (set on if-needed basis).
*/
//double startup_cost;
bool
*
get_cond_guard
(
int
i
)
bool
*
get_cond_guard
(
int
i
)
{
{
return
pushed_cond_guards
?
pushed_cond_guards
+
i
:
NULL
;
return
pushed_cond_guards
?
pushed_cond_guards
+
i
:
NULL
;
...
...
sql/sql_join_cache.h
View file @
6efcad28
...
@@ -650,8 +650,6 @@ class JOIN_CACHE :public Sql_alloc
...
@@ -650,8 +650,6 @@ class JOIN_CACHE :public Sql_alloc
buff
=
0
;
buff
=
0
;
}
}
// JOIN_TAB *get_next_table(JOIN_TAB *tab);
friend
class
JOIN_CACHE_HASHED
;
friend
class
JOIN_CACHE_HASHED
;
friend
class
JOIN_CACHE_BNL
;
friend
class
JOIN_CACHE_BNL
;
friend
class
JOIN_CACHE_BKA
;
friend
class
JOIN_CACHE_BKA
;
...
...
sql/sql_select.cc
View file @
6efcad28
...
@@ -242,9 +242,6 @@ static uint make_join_orderinfo(JOIN *join);
...
@@ -242,9 +242,6 @@ static uint make_join_orderinfo(JOIN *join);
Item_equal
*
find_item_equal
(
COND_EQUAL
*
cond_equal
,
Field
*
field
,
Item_equal
*
find_item_equal
(
COND_EQUAL
*
cond_equal
,
Field
*
field
,
bool
*
inherited_fl
);
bool
*
inherited_fl
);
JOIN_TAB
*
first_linear_tab
(
JOIN
*
join
,
bool
after_const_tables
);
JOIN_TAB
*
next_linear_tab
(
JOIN
*
join
,
JOIN_TAB
*
tab
,
bool
include_bush_roots
);
/**
/**
This handles SELECT with and without UNION.
This handles SELECT with and without UNION.
*/
*/
...
@@ -8569,6 +8566,12 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
...
@@ -8569,6 +8566,12 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
tab
->
sorted
=
sorted
;
tab
->
sorted
=
sorted
;
sorted
=
0
;
// only first must be sorted
sorted
=
0
;
// only first must be sorted
/*
We should not set tab->next_select for the last table in the
SMJ-nest, as setup_sj_materialization() has already set it to
end_sj_materialize.
*/
if
(
!
(
tab
->
bush_root_tab
&&
if
(
!
(
tab
->
bush_root_tab
&&
tab
->
bush_root_tab
->
bush_children
->
end
==
tab
+
1
))
tab
->
bush_root_tab
->
bush_children
->
end
==
tab
+
1
))
{
{
...
@@ -12910,7 +12913,6 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
...
@@ -12910,7 +12913,6 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
i
<
field_count
;
i
<
field_count
;
i
++
,
reg_field
++
,
key_part_info
++
)
i
++
,
reg_field
++
,
key_part_info
++
)
{
{
key_part_info
->
null_bit
=
0
;
key_part_info
->
field
=
*
reg_field
;
key_part_info
->
field
=
*
reg_field
;
(
*
reg_field
)
->
flags
|=
PART_KEY_FLAG
;
(
*
reg_field
)
->
flags
|=
PART_KEY_FLAG
;
if
(
key_part_info
==
keyinfo
->
key_part
)
if
(
key_part_info
==
keyinfo
->
key_part
)
...
...
sql/sql_select.h
View file @
6efcad28
...
@@ -616,7 +616,6 @@ inline bool sj_is_materialize_strategy(uint strategy)
...
@@ -616,7 +616,6 @@ inline bool sj_is_materialize_strategy(uint strategy)
return
strategy
>=
SJ_OPT_MATERIALIZE
;
return
strategy
>=
SJ_OPT_MATERIALIZE
;
}
}
class
JOIN_TAB_RANGE
:
public
Sql_alloc
class
JOIN_TAB_RANGE
:
public
Sql_alloc
{
{
public:
public:
...
@@ -1050,6 +1049,9 @@ class JOIN :public Sql_alloc
...
@@ -1050,6 +1049,9 @@ class JOIN :public Sql_alloc
};
};
JOIN_TAB
*
first_linear_tab
(
JOIN
*
join
,
bool
after_const_tables
);
JOIN_TAB
*
next_linear_tab
(
JOIN
*
join
,
JOIN_TAB
*
tab
,
bool
include_bush_roots
);
typedef
struct
st_select_check
{
typedef
struct
st_select_check
{
uint
const_ref
,
reg_ref
;
uint
const_ref
,
reg_ref
;
}
SELECT_CHECK
;
}
SELECT_CHECK
;
...
...
sql/sql_show.cc
View file @
6efcad28
...
@@ -6584,9 +6584,6 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
...
@@ -6584,9 +6584,6 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
}
}
JOIN_TAB
*
first_linear_tab
(
JOIN
*
join
,
bool
after_const_tables
);
JOIN_TAB
*
next_linear_tab
(
JOIN
*
join
,
JOIN_TAB
*
tab
,
bool
include_bush_roots
);
/*
/*
Fill temporary schema tables before SELECT
Fill temporary schema tables before SELECT
...
...
sql/table.cc
View file @
6efcad28
...
@@ -5335,6 +5335,13 @@ bool st_table::is_children_attached(void)
...
@@ -5335,6 +5335,13 @@ bool st_table::is_children_attached(void)
}
}
/*
Return TRUE if the table is filled at execution phase
(and so, the optimizer must not do anything that depends on the contents of
the table, like range analysis or constant table detection)
*/
bool
st_table
::
is_filled_at_execution
()
bool
st_table
::
is_filled_at_execution
()
{
{
return
test
(
pos_in_table_list
->
jtbm_subselect
);
return
test
(
pos_in_table_list
->
jtbm_subselect
);
...
...
sql/table.h
View file @
6efcad28
...
@@ -968,9 +968,9 @@ struct st_table {
...
@@ -968,9 +968,9 @@ struct st_table {
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
/*
/*
If TRUE, the table is filled at execution phase (and so, the optimizer
Returns TRUE if the table is filled at execution phase (and so, the
should not do things like range analysis or constant table detection on
optimizer must not do anything that depends on the contents of the table,
it).
like range analysis or constant table detection)
*/
*/
bool
is_filled_at_execution
();
bool
is_filled_at_execution
();
inline
void
disable_keyread
()
inline
void
disable_keyread
()
...
...
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