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
ab96fa07
Commit
ab96fa07
authored
Apr 01, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/Users/kent/mysql/bk/mysql-5.0-new
parents
872d1d71
a432c53f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
9 deletions
+95
-9
innobase/btr/btr0sea.c
innobase/btr/btr0sea.c
+8
-6
mysql-test/r/group_min_max.result
mysql-test/r/group_min_max.result
+9
-0
mysql-test/t/group_min_max.test
mysql-test/t/group_min_max.test
+8
-0
sql/ha_innodb.cc
sql/ha_innodb.cc
+8
-2
sql/item.cc
sql/item.cc
+34
-1
sql/item.h
sql/item.h
+2
-0
sql/opt_range.cc
sql/opt_range.cc
+26
-0
No files found.
innobase/btr/btr0sea.c
View file @
ab96fa07
...
...
@@ -59,9 +59,6 @@ before hash index building is started */
#define BTR_SEARCH_BUILD_LIMIT 100
/* How many cells to check before temporarily releasing btr_search_latch */
#define BTR_CHUNK_SIZE 10000
/************************************************************************
Builds a hash index on a page with the given parameters. If the page already
has a hash index with different parameters, the old hash index is removed.
...
...
@@ -1607,6 +1604,11 @@ btr_search_validate(void)
mem_heap_t
*
heap
=
NULL
;
ulint
offsets_
[
REC_OFFS_NORMAL_SIZE
];
ulint
*
offsets
=
offsets_
;
/* How many cells to check before temporarily releasing
btr_search_latch. */
ulint
chunk_size
=
10000
;
*
offsets_
=
(
sizeof
offsets_
)
/
sizeof
*
offsets_
;
rw_lock_x_lock
(
&
btr_search_latch
);
...
...
@@ -1616,7 +1618,7 @@ btr_search_validate(void)
for
(
i
=
0
;
i
<
cell_count
;
i
++
)
{
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
if
((
i
!=
0
)
&&
((
i
%
BTR_CHUNK_SIZE
)
==
0
))
{
if
((
i
!=
0
)
&&
((
i
%
chunk_size
)
==
0
))
{
rw_lock_x_unlock
(
&
btr_search_latch
);
os_thread_yield
();
rw_lock_x_lock
(
&
btr_search_latch
);
...
...
@@ -1675,8 +1677,8 @@ btr_search_validate(void)
}
}
for
(
i
=
0
;
i
<
cell_count
;
i
+=
BTR_CHUNK_SIZE
)
{
ulint
end_index
=
ut_min
(
i
+
BTR_CHUNK_SIZE
-
1
,
cell_count
-
1
);
for
(
i
=
0
;
i
<
cell_count
;
i
+=
chunk_size
)
{
ulint
end_index
=
ut_min
(
i
+
chunk_size
-
1
,
cell_count
-
1
);
/* We release btr_search_latch every once in a while to
give other queries a chance to run. */
...
...
mysql-test/r/group_min_max.result
View file @
ab96fa07
...
...
@@ -1954,6 +1954,15 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select sum(ord(a1)) from t1 where (a1 > 'a') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 163 NULL 128 Using where; Using index
explain select distinct(a1) from t1 where ord(a2) = 98;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
select distinct(a1) from t1 where ord(a2) = 98;
a1
a
b
c
d
explain select a1 from t1 where a2 = 'b' group by a1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using where; Using index for group-by
...
...
mysql-test/t/group_min_max.test
View file @
ab96fa07
...
...
@@ -641,6 +641,14 @@ explain select a1,a2,count(a2) from t1 group by a1,a2,b;
explain select a1,a2,count(a2) from t1 where (a1 > '
a
') group by a1,a2,b;
explain select sum(ord(a1)) from t1 where (a1 > '
a
') group by a1,a2,b;
#
# Bug #16710: select distinct doesn'
t
return
all
it
should
#
explain
select
distinct
(
a1
)
from
t1
where
ord
(
a2
)
=
98
;
select
distinct
(
a1
)
from
t1
where
ord
(
a2
)
=
98
;
#
# BUG#11044: DISTINCT or GROUP BY queries with equality predicates instead of MIN/MAX.
#
...
...
sql/ha_innodb.cc
View file @
ab96fa07
...
...
@@ -989,7 +989,6 @@ innobase_query_caching_of_table_permitted(
mutex_enter_noninline
(
&
kernel_mutex
);
trx_print
(
stderr
,
trx
,
1024
);
mutex_exit_noninline
(
&
kernel_mutex
);
ut_error
;
}
innobase_release_stat_resources
(
trx
);
...
...
@@ -3832,7 +3831,14 @@ ha_innobase::unlock_row(void)
mem_analyze_corruption
((
byte
*
)
prebuilt
->
trx
);
ut_error
;
}
/* Consistent read does not take any locks, thus there is
nothing to unlock. */
if
(
prebuilt
->
select_lock_type
==
LOCK_NONE
)
{
DBUG_VOID_RETURN
;
}
if
(
srv_locks_unsafe_for_binlog
)
{
row_unlock_for_mysql
(
prebuilt
,
FALSE
);
}
...
...
sql/item.cc
View file @
ab96fa07
...
...
@@ -496,7 +496,7 @@ bool Item_ident::remove_dependence_processor(byte * arg)
arguments in a condition the method must return false.
RETURN
false
to force the evaluation of collect_item_field_processor
FALSE
to force the evaluation of collect_item_field_processor
for the subsequent items.
*/
...
...
@@ -517,6 +517,39 @@ bool Item_field::collect_item_field_processor(byte *arg)
}
/*
Check if an Item_field references some field from a list of fields.
SYNOPSIS
Item_field::find_item_in_field_list_processor
arg Field being compared, arg must be of type Field
DESCRIPTION
Check whether the Item_field represented by 'this' references any
of the fields in the keyparts passed via 'arg'. Used with the
method Item::walk() to test whether any keypart in a sequence of
keyparts is referenced in an expression.
RETURN
TRUE if 'this' references the field 'arg'
FALSE otherwise
*/
bool
Item_field
::
find_item_in_field_list_processor
(
byte
*
arg
)
{
KEY_PART_INFO
*
first_non_group_part
=
*
((
KEY_PART_INFO
**
)
arg
);
KEY_PART_INFO
*
last_part
=
*
(((
KEY_PART_INFO
**
)
arg
)
+
1
);
KEY_PART_INFO
*
cur_part
;
for
(
cur_part
=
first_non_group_part
;
cur_part
!=
last_part
;
cur_part
++
)
{
if
(
field
->
eq
(
cur_part
->
field
))
return
TRUE
;
}
return
FALSE
;
}
bool
Item
::
check_cols
(
uint
c
)
{
if
(
c
!=
1
)
...
...
sql/item.h
View file @
ab96fa07
...
...
@@ -701,6 +701,7 @@ class Item {
virtual
bool
remove_fixed
(
byte
*
arg
)
{
fixed
=
0
;
return
0
;
}
virtual
bool
cleanup_processor
(
byte
*
arg
);
virtual
bool
collect_item_field_processor
(
byte
*
arg
)
{
return
0
;
}
virtual
bool
find_item_in_field_list_processor
(
byte
*
arg
)
{
return
0
;
}
virtual
bool
change_context_processor
(
byte
*
context
)
{
return
0
;
}
virtual
bool
reset_query_id_processor
(
byte
*
query_id
)
{
return
0
;
}
...
...
@@ -1149,6 +1150,7 @@ class Item_field :public Item_ident
bool
is_null
()
{
return
field
->
is_null
();
}
Item
*
get_tmp_table_item
(
THD
*
thd
);
bool
collect_item_field_processor
(
byte
*
arg
);
bool
find_item_in_field_list_processor
(
byte
*
arg
);
bool
reset_query_id_processor
(
byte
*
arg
)
{
field
->
query_id
=
*
((
query_id_t
*
)
arg
);
...
...
sql/opt_range.cc
View file @
ab96fa07
...
...
@@ -6895,6 +6895,7 @@ cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts,
bool
have_min
,
bool
have_max
,
double
*
read_cost
,
ha_rows
*
records
);
/*
Test if this access method is applicable to a GROUP query with MIN/MAX
functions, and if so, construct a new TRP object.
...
...
@@ -7301,11 +7302,36 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree)
}
else
if
(
min_max_arg_part
&&
(
min_max_arg_part
-
first_non_group_part
>
0
))
{
/*
There is a gap but no range tree, thus no predicates at all for the
non-group keyparts.
*/
goto
next_index
;
}
else
if
(
first_non_group_part
&&
join
->
conds
)
{
/*
If there is no MIN/MAX function in the query, but some index
key part is referenced in the WHERE clause, then this index
cannot be used because the WHERE condition over the keypart's
field cannot be 'pushed' to the index (because there is no
range 'tree'), and the WHERE clause must be evaluated before
GROUP BY/DISTINCT.
*/
/*
Store the first and last keyparts that need to be analyzed
into one array that can be passed as parameter.
*/
KEY_PART_INFO
*
key_part_range
[
2
];
key_part_range
[
0
]
=
first_non_group_part
;
key_part_range
[
1
]
=
last_part
;
/* Check if cur_part is referenced in the WHERE clause. */
if
(
join
->
conds
->
walk
(
&
Item
::
find_item_in_field_list_processor
,
(
byte
*
)
key_part_range
))
goto
next_index
;
}
}
/*
...
...
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