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
a431e912
Commit
a431e912
authored
Feb 27, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/psergey/mysql-5.0-bug17314-push
parents
b97082c5
f37f4b01
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
5 deletions
+87
-5
myisammrg/myrg_queue.c
myisammrg/myrg_queue.c
+17
-3
mysql-test/r/index_merge.result
mysql-test/r/index_merge.result
+22
-0
mysql-test/r/merge.result
mysql-test/r/merge.result
+1
-1
mysql-test/t/index_merge.test
mysql-test/t/index_merge.test
+26
-0
sql/ha_myisammrg.cc
sql/ha_myisammrg.cc
+21
-1
No files found.
myisammrg/myrg_queue.c
View file @
a431e912
...
...
@@ -18,12 +18,26 @@
static
int
queue_key_cmp
(
void
*
keyseg
,
byte
*
a
,
byte
*
b
)
{
MI_INFO
*
aa
=
((
MYRG_TABLE
*
)
a
)
->
table
;
MI_INFO
*
bb
=
((
MYRG_TABLE
*
)
b
)
->
table
;
MYRG_TABLE
*
ma
=
(
MYRG_TABLE
*
)
a
;
MYRG_TABLE
*
mb
=
(
MYRG_TABLE
*
)
b
;
MI_INFO
*
aa
=
ma
->
table
;
MI_INFO
*
bb
=
mb
->
table
;
uint
not_used
[
2
];
int
ret
=
ha_key_cmp
((
HA_KEYSEG
*
)
keyseg
,
aa
->
lastkey
,
bb
->
lastkey
,
USE_WHOLE_KEY
,
SEARCH_FIND
,
not_used
);
return
ret
<
0
?
-
1
:
ret
>
0
?
1
:
0
;
if
(
ret
<
0
)
return
-
1
;
if
(
ret
>
0
)
return
1
;
/*
If index tuples have the same values, let the record with least rowid
value be "smaller", so index scans return records ordered by (keytuple,
rowid). This is used by index_merge access method, grep for ROR in
sql/opt_range.cc for details.
*/
return
(
ma
->
file_offset
<
mb
->
file_offset
)
?
-
1
:
(
ma
->
file_offset
>
mb
->
file_offset
)
?
1
:
0
;
}
/* queue_key_cmp */
...
...
mysql-test/r/index_merge.result
View file @
a431e912
...
...
@@ -402,3 +402,25 @@ explain select * from t1 force index(cola,colb) WHERE cola = 'foo' AND colb = 'b
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge cola,colb cola,colb 3,3 NULL 24 Using intersect(cola,colb); Using where
drop table t1;
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 (
a int, b int,
filler1 char(200), filler2 char(200),
key(a),key(b)
);
insert into t1 select @v:= A.a, @v, 't1', 'filler2' from t0 A, t0 B, t0 C;
create table t2 like t1;
create table t3 (
a int, b int,
filler1 char(200), filler2 char(200),
key(a),key(b)
) engine=merge union=(t1,t2);
explain select * from t1 where a=1 and b=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where
explain select * from t3 where a=1 and b=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 index_merge a,b a,b 5,5 NULL # Using intersect(a,b); Using where
drop table t3;
drop table t0, t1, t2;
mysql-test/r/merge.result
View file @
a431e912
...
...
@@ -56,8 +56,8 @@ a b
4 Testing
5 table
5 table
6 t1
6 t2
6 t1
7 Testing
7 Testing
8 table
...
...
mysql-test/t/index_merge.test
View file @
a431e912
...
...
@@ -357,3 +357,29 @@ explain select * from t1 WHERE cola = 'foo' AND colb = 'bar';
explain
select
*
from
t1
force
index
(
cola
,
colb
)
WHERE
cola
=
'foo'
AND
colb
=
'bar'
;
drop
table
t1
;
#
# BUG#17314: Index_merge/intersection not choosen by the optimizer for MERGE tables
#
create
table
t0
(
a
int
);
insert
into
t0
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
5
),(
6
),(
7
),(
8
),(
9
);
create
table
t1
(
a
int
,
b
int
,
filler1
char
(
200
),
filler2
char
(
200
),
key
(
a
),
key
(
b
)
);
insert
into
t1
select
@
v
:=
A
.
a
,
@
v
,
't1'
,
'filler2'
from
t0
A
,
t0
B
,
t0
C
;
create
table
t2
like
t1
;
create
table
t3
(
a
int
,
b
int
,
filler1
char
(
200
),
filler2
char
(
200
),
key
(
a
),
key
(
b
)
)
engine
=
merge
union
=
(
t1
,
t2
);
--
replace_column
9
#
explain
select
*
from
t1
where
a
=
1
and
b
=
1
;
--
replace_column
9
#
explain
select
*
from
t3
where
a
=
1
and
b
=
1
;
drop
table
t3
;
drop
table
t0
,
t1
,
t2
;
sql/ha_myisammrg.cc
View file @
a431e912
...
...
@@ -288,7 +288,27 @@ void ha_myisammrg::info(uint flag)
table
->
s
->
db_options_in_use
=
info
.
options
;
table
->
s
->
is_view
=
1
;
mean_rec_length
=
info
.
reclength
;
block_size
=
0
;
/*
The handler::block_size is used all over the code in index scan cost
calculations. It is used to get number of disk seeks required to
retrieve a number of index tuples.
If the merge table has N underlying tables, then (assuming underlying
tables have equal size, the only "simple" approach we can use)
retrieving X index records from a merge table will require N times more
disk seeks compared to doing the same on a MyISAM table with equal
number of records.
In the edge case (file_tables > myisam_block_size) we'll get
block_size==0, and index calculation code will act as if we need one
disk seek to retrieve one index tuple.
TODO: In 5.2 index scan cost calculation will be factored out into a
virtual function in class handler and we'll be able to remove this hack.
*/
block_size
=
0
;
if
(
file
->
tables
)
block_size
=
myisam_block_size
/
file
->
tables
;
update_time
=
0
;
#if SIZEOF_OFF_T > 4
ref_length
=
6
;
// Should be big enough
...
...
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