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
dcc65b77
Commit
dcc65b77
authored
Feb 08, 2005
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for BUG#8371: wrong rec_per_key value for hash index on temporary table
parent
1c2f4ffe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
6 deletions
+24
-6
mysql-test/r/heap_hash.result
mysql-test/r/heap_hash.result
+10
-0
mysql-test/t/heap_hash.test
mysql-test/t/heap_hash.test
+6
-0
sql/ha_heap.cc
sql/ha_heap.cc
+7
-6
sql/sql_select.cc
sql/sql_select.cc
+1
-0
No files found.
mysql-test/r/heap_hash.result
View file @
dcc65b77
...
...
@@ -355,3 +355,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
1 SIMPLE t3 ref a a 40 func,const 6 Using where
drop table t1, t2, t3;
create temporary table t1 ( a int, index (a) ) engine=memory;
insert into t1 values (1),(2),(3),(4),(5);
select a from t1 where a in (1,3);
a
1
3
explain select a from t1 where a in (1,3);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 5 NULL 2 Using where
drop table t1;
mysql-test/t/heap_hash.test
View file @
dcc65b77
...
...
@@ -251,3 +251,9 @@ explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a
drop
table
t1
,
t2
,
t3
;
# Fix for BUG#8371: wrong rec_per_key value for hash index on temporary table
create
temporary
table
t1
(
a
int
,
index
(
a
)
)
engine
=
memory
;
insert
into
t1
values
(
1
),(
2
),(
3
),(
4
),(
5
);
select
a
from
t1
where
a
in
(
1
,
3
);
explain
select
a
from
t1
where
a
in
(
1
,
3
);
drop
table
t1
;
sql/ha_heap.cc
View file @
dcc65b77
...
...
@@ -60,8 +60,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
/* Initialize variables for the opened table */
set_keys_for_scanning
();
if
(
table
->
tmp_table
==
NO_TMP_TABLE
)
update_key_stats
();
update_key_stats
();
}
return
(
file
?
0
:
1
);
}
...
...
@@ -103,6 +102,8 @@ void ha_heap::update_key_stats()
for
(
uint
i
=
0
;
i
<
table
->
keys
;
i
++
)
{
KEY
*
key
=
table
->
key_info
+
i
;
if
(
!
key
->
rec_per_key
)
continue
;
if
(
key
->
algorithm
!=
HA_KEY_ALG_BTREE
)
{
ha_rows
hash_buckets
=
file
->
s
->
keydef
[
i
].
hash_buckets
;
...
...
@@ -122,8 +123,8 @@ int ha_heap::write_row(byte * buf)
if
(
table
->
next_number_field
&&
buf
==
table
->
record
[
0
])
update_auto_increment
();
res
=
heap_write
(
file
,
buf
);
if
(
!
res
&&
table
->
tmp_table
==
NO_TMP_TABLE
&&
++
records_changed
*
HEAP_STATS_UPDATE_THRESHOLD
>
file
->
s
->
records
)
if
(
!
res
&&
++
records_changed
*
HEAP_STATS_UPDATE_THRESHOLD
>
file
->
s
->
records
)
update_key_stats
();
return
res
;
}
...
...
@@ -135,8 +136,8 @@ int ha_heap::update_row(const byte * old_data, byte * new_data)
if
(
table
->
timestamp_field_type
&
TIMESTAMP_AUTO_SET_ON_UPDATE
)
table
->
timestamp_field
->
set_time
();
res
=
heap_update
(
file
,
old_data
,
new_data
);
if
(
!
res
&&
table
->
tmp_table
==
NO_TMP_TABLE
&&
++
records_changed
*
HEAP_STATS_UPDATE_THRESHOLD
>
file
->
s
->
records
)
if
(
!
res
&&
++
records_changed
*
HEAP_STATS_UPDATE_THRESHOLD
>
file
->
s
->
records
)
update_key_stats
();
return
res
;
}
...
...
sql/sql_select.cc
View file @
dcc65b77
...
...
@@ -5289,6 +5289,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
keyinfo
->
key_length
=
(
uint16
)
reclength
;
keyinfo
->
name
=
(
char
*
)
"tmp"
;
keyinfo
->
algorithm
=
HA_KEY_ALG_UNDEF
;
keyinfo
->
rec_per_key
=
0
;
if
(
null_pack_length
)
{
key_part_info
->
null_bit
=
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