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
33c8796b
Commit
33c8796b
authored
Jun 02, 2011
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
c44c1bd1
8bf69ab7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
12 deletions
+29
-12
sql/sql_select.cc
sql/sql_select.cc
+29
-12
No files found.
sql/sql_select.cc
View file @
33c8796b
...
...
@@ -2494,8 +2494,7 @@ JOIN::exec()
}
if
(
curr_table
->
pre_idx_push_select_cond
)
{
if
(
sort_table_cond
->
type
()
==
Item
::
COND_ITEM
&&
sort_table_cond
!=
curr_table
->
select
->
cond
)
if
(
sort_table_cond
->
type
()
==
Item
::
COND_ITEM
)
sort_table_cond
=
sort_table_cond
->
copy_andor_structure
(
thd
);
if
(
!
(
curr_table
->
pre_idx_push_select_cond
=
new
Item_cond_and
(
curr_table
->
pre_idx_push_select_cond
,
...
...
@@ -16850,7 +16849,10 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg,
SQL_SELECT
*
select
=
tab
->
select
;
key_map
usable_keys
;
QUICK_SELECT_I
*
save_quick
=
select
?
select
->
quick
:
0
;
Item
*
orig_cond
=
0
;
bool
orig_cond_saved
=
false
;
int
best_key
=
-
1
;
bool
changed_key
=
false
;
ha_rows
best_select_limit
;
DBUG_ENTER
(
"test_if_skip_sort_order"
);
...
...
@@ -16920,6 +16922,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg,
*/
if
(
table
->
covering_keys
.
is_set
(
ref_key
))
usable_keys
.
intersect
(
table
->
covering_keys
);
if
(
tab
->
pre_idx_push_select_cond
)
{
orig_cond
=
tab
->
set_cond
(
tab
->
pre_idx_push_select_cond
);
orig_cond_saved
=
true
;
}
if
((
new_ref_key
=
test_if_subkey
(
order
,
table
,
ref_key
,
ref_key_parts
,
&
usable_keys
))
<
MAX_KEY
)
...
...
@@ -16983,6 +16990,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg,
*/
}
ref_key
=
new_ref_key
;
changed_key
=
true
;
}
}
/* Check if we get the rows in requested sorted order by using the key */
...
...
@@ -17248,6 +17256,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg,
*/
used_key_parts
=
(
order_direction
==
-
1
)
?
saved_best_key_parts
:
best_key_parts
;
changed_key
=
true
;
}
check_reverse_order:
...
...
@@ -17309,15 +17318,13 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg,
table
->
enable_keyread
();
if
(
tab
->
pre_idx_push_select_cond
)
{
COND
*
tmp_cond
=
tab
->
pre_idx_push_select_cond
;
COND
*
orig_select_cond
=
tab
->
select_cond
;
if
(
orig_select_cond
)
{
tmp_cond
=
and_conds
(
tmp_cond
,
orig_select_cond
);
tmp_cond
->
quick_fix_field
();
}
tab
->
set_cond
(
tmp_cond
);
tab
->
set_cond
(
tab
->
pre_idx_push_select_cond
);
/*
orig_cond is a part of pre_idx_push_cond,
no need to restore it.
*/
orig_cond
=
0
;
orig_cond_saved
=
false
;
}
table
->
file
->
ha_index_or_rnd_end
();
if
(
tab
->
join
->
select_options
&
SELECT_DESCRIBE
)
...
...
@@ -17409,6 +17416,14 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg,
delete
save_quick
;
save_quick
=
NULL
;
}
/*
orig_cond is a part of pre_idx_push_cond,
no need to restore it.
*/
orig_cond
=
0
;
orig_cond_saved
=
false
;
if
(
orig_cond_saved
&&
!
changed_key
)
tab
->
set_cond
(
orig_cond
);
DBUG_RETURN
(
1
);
use_filesort:
...
...
@@ -17418,6 +17433,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit_arg,
delete
select
->
quick
;
select
->
quick
=
save_quick
;
}
if
(
orig_cond_saved
)
tab
->
set_cond
(
orig_cond
);
DBUG_RETURN
(
0
);
}
...
...
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