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
98df5f7c
Commit
98df5f7c
authored
Aug 27, 2010
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Plain Diff
Merge 5.1-bugteam to 5.5-merge.
parents
04370e73
e433cb33
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
134 additions
and
23 deletions
+134
-23
client/mysqltest.cc
client/mysqltest.cc
+2
-0
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/r/innodb_mysql.result
+58
-0
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/suite/innodb/t/innodb_mysql.test
+24
-0
sql/sql_select.cc
sql/sql_select.cc
+42
-18
sql/sql_show.cc
sql/sql_show.cc
+8
-5
No files found.
client/mysqltest.cc
View file @
98df5f7c
...
...
@@ -6228,8 +6228,10 @@ get_one_option(int optid, const struct my_option *opt, char *argument)
print_version
();
exit
(
0
);
case
OPT_MYSQL_PROTOCOL
:
#ifndef EMBEDDED_LIBRARY
opt_protocol
=
find_type_or_exit
(
argument
,
&
sql_protocol_typelib
,
opt
->
name
);
#endif
break
;
case
'?'
:
usage
();
...
...
mysql-test/suite/innodb/r/innodb_mysql.result
View file @
98df5f7c
...
...
@@ -2546,6 +2546,64 @@ LOCK TABLES t1 READ;
ALTER TABLE t1 COMMENT 'test';
UNLOCK TABLES;
DROP TABLE t1;
#
# Bug#55656: mysqldump can be slower after bug #39653 fix
#
CREATE TABLE t1 (a INT , b INT, c INT, d INT,
KEY (b), PRIMARY KEY (a,b)) ENGINE=INNODB;
INSERT INTO t1 VALUES (1,1,1,1), (2,2,2,2), (3,3,3,3);
EXPLAIN SELECT COUNT(*) FROM t1;
id 1
select_type SIMPLE
table t1
type index
possible_keys NULL
key b
key_len 4
ref NULL
rows 3
Extra Using index
DROP INDEX b ON t1;
CREATE INDEX b ON t1(a,b);
EXPLAIN SELECT COUNT(*) FROM t1;
id 1
select_type SIMPLE
table t1
type index
possible_keys NULL
key b
key_len 8
ref NULL
rows 3
Extra Using index
DROP INDEX b ON t1;
CREATE INDEX b ON t1(a,b,c);
EXPLAIN SELECT COUNT(*) FROM t1;
id 1
select_type SIMPLE
table t1
type index
possible_keys NULL
key b
key_len 13
ref NULL
rows 3
Extra Using index
DROP INDEX b ON t1;
CREATE INDEX b ON t1(a,b,c,d);
EXPLAIN SELECT COUNT(*) FROM t1;
id 1
select_type SIMPLE
table t1
type index
possible_keys NULL
key PRIMARY
key_len 8
ref NULL
rows 3
Extra Using index
DROP TABLE t1;
#
End of 5.1 tests
#
# Test for bug #39932 "create table fails if column for FK is in different
...
...
mysql-test/suite/innodb/t/innodb_mysql.test
View file @
98df5f7c
...
...
@@ -746,6 +746,30 @@ UNLOCK TABLES;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#55656: mysqldump can be slower after bug #39653 fix
--
echo
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
c
INT
,
d
INT
,
KEY
(
b
),
PRIMARY
KEY
(
a
,
b
))
ENGINE
=
INNODB
;
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
,
1
),
(
2
,
2
,
2
,
2
),
(
3
,
3
,
3
,
3
);
--
query_vertical
EXPLAIN
SELECT
COUNT
(
*
)
FROM
t1
DROP
INDEX
b
ON
t1
;
CREATE
INDEX
b
ON
t1
(
a
,
b
);
--
query_vertical
EXPLAIN
SELECT
COUNT
(
*
)
FROM
t1
DROP
INDEX
b
ON
t1
;
CREATE
INDEX
b
ON
t1
(
a
,
b
,
c
);
--
query_vertical
EXPLAIN
SELECT
COUNT
(
*
)
FROM
t1
DROP
INDEX
b
ON
t1
;
CREATE
INDEX
b
ON
t1
(
a
,
b
,
c
,
d
);
--
query_vertical
EXPLAIN
SELECT
COUNT
(
*
)
FROM
t1
DROP
TABLE
t1
;
--
echo
#
--
echo
End
of
5.1
tests
...
...
sql/sql_select.cc
View file @
98df5f7c
...
...
@@ -13243,6 +13243,34 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx,
}
/**
Find shortest key suitable for full table scan.
@param table Table to scan
@param usable_keys Allowed keys
@note
As far as
1) clustered primary key entry data set is a set of all record
fields (key fields and not key fields) and
2) secondary index entry data is a union of its key fields and
primary key fields (at least InnoDB and its derivatives don't
duplicate primary key fields there, even if the primary and
the secondary keys have a common subset of key fields),
then secondary index entry data is always a subset of primary key entry.
Unfortunately, key_info[nr].key_length doesn't show the length
of key/pointer pair but a sum of key field lengths only, thus
we can't estimate index IO volume comparing only this key_length
value of secondary keys and clustered PK.
So, try secondary keys first, and choose PK only if there are no
usable secondary covering keys or found best secondary key include
all table fields (i.e. same as PK):
@return
MAX_KEY no suitable key found
key index otherwise
*/
uint
find_shortest_key
(
TABLE
*
table
,
const
key_map
*
usable_keys
)
{
uint
best
=
MAX_KEY
;
...
...
@@ -13255,23 +13283,6 @@ uint find_shortest_key(TABLE *table, const key_map *usable_keys)
uint
min_length
=
(
uint
)
~
0
;
for
(
uint
nr
=
0
;
nr
<
table
->
s
->
keys
;
nr
++
)
{
/*
As far as
1) clustered primary key entry data set is a set of all record
fields (key fields and not key fields) and
2) secondary index entry data is a union of its key fields and
primary key fields (at least InnoDB and its derivatives don't
duplicate primary key fields there, even if the primary and
the secondary keys have a common subset of key fields),
then secondary index entry data is always a subset of primary key
entry, and the PK is always longer.
Unfortunately, key_info[nr].key_length doesn't show the length
of key/pointer pair but a sum of key field lengths only, thus
we can't estimate index IO volume comparing only this key_length
value of seconday keys and clustered PK.
So, try secondary keys first, and choose PK only if there are no
usable secondary covering keys:
*/
if
(
nr
==
usable_clustered_pk
)
continue
;
if
(
usable_keys
->
is_set
(
nr
))
...
...
@@ -13284,7 +13295,20 @@ uint find_shortest_key(TABLE *table, const key_map *usable_keys)
}
}
}
return
best
!=
MAX_KEY
?
best
:
usable_clustered_pk
;
if
(
usable_clustered_pk
!=
MAX_KEY
)
{
/*
If the primary key is clustered and found shorter key covers all table
fields then primary key scan normally would be faster because amount of
data to scan is the same but PK is clustered.
It's safe to compare key parts with table fields since duplicate key
parts aren't allowed.
*/
if
(
best
==
MAX_KEY
||
table
->
key_info
[
best
].
key_parts
>=
table
->
s
->
fields
)
best
=
usable_clustered_pk
;
}
return
best
;
}
/**
...
...
sql/sql_show.cc
View file @
98df5f7c
...
...
@@ -7490,13 +7490,16 @@ int finalize_schema_table(st_plugin_int *plugin)
ST_SCHEMA_TABLE
*
schema_table
=
(
ST_SCHEMA_TABLE
*
)
plugin
->
data
;
DBUG_ENTER
(
"finalize_schema_table"
);
if
(
schema_table
&&
plugin
->
plugin
->
deinit
)
if
(
schema_table
)
{
DBUG_PRINT
(
"info"
,
(
"Deinitializing plugin: '%s'"
,
plugin
->
name
.
str
));
if
(
plugin
->
plugin
->
deinit
(
NULL
))
if
(
plugin
->
plugin
->
deinit
)
{
DBUG_PRINT
(
"warning"
,
(
"Plugin '%s' deinit function returned error."
,
plugin
->
name
.
str
));
DBUG_PRINT
(
"info"
,
(
"Deinitializing plugin: '%s'"
,
plugin
->
name
.
str
));
if
(
plugin
->
plugin
->
deinit
(
NULL
))
{
DBUG_PRINT
(
"warning"
,
(
"Plugin '%s' deinit function returned error."
,
plugin
->
name
.
str
));
}
}
my_free
(
schema_table
);
}
...
...
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