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
6d1fab66
Commit
6d1fab66
authored
May 22, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B28476-5.0-opt
parents
b50d17a9
604ef463
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
6 deletions
+93
-6
mysql-test/r/key.result
mysql-test/r/key.result
+8
-0
mysql-test/r/myisam.result
mysql-test/r/myisam.result
+26
-0
mysql-test/t/key.test
mysql-test/t/key.test
+12
-0
mysql-test/t/myisam.test
mysql-test/t/myisam.test
+16
-0
sql/sql_base.cc
sql/sql_base.cc
+6
-1
sql/sql_select.cc
sql/sql_select.cc
+4
-3
sql/table.h
sql/table.h
+21
-2
No files found.
mysql-test/r/key.result
View file @
6d1fab66
...
...
@@ -455,3 +455,11 @@ ORDER BY c.b, c.d
a b c d e f g h i j a b c d
2 2 1 2004-11-30 12:00:00 1 0 0 0 0 0 2 3388000 -553000 NULL
DROP TABLE t1, t2;
CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES( 1 );
ALTER TABLE t1 DISABLE KEYS;
EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
DROP TABLE t1;
End of 5.0 tests.
mysql-test/r/myisam.result
View file @
6d1fab66
...
...
@@ -1780,4 +1780,30 @@ create table t3 (c1 int) engine=myisam pack_keys=default;
create table t4 (c1 int) engine=myisam pack_keys=2;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2' at line 1
drop table t1, t2, t3;
CREATE TABLE t1(a INT, b INT, KEY inx (a), UNIQUE KEY uinx (b)) ENGINE=MyISAM;
INSERT INTO t1(a,b) VALUES (1,1),(2,2),(3,3),(4,4),(5,5);
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
a
1
ALTER TABLE t1 DISABLE KEYS;
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
a
1
SELECT a FROM t1 USE INDEX (inx) WHERE a=1;
a
1
SELECT b FROM t1 FORCE INDEX (uinx) WHERE b=1;
b
1
SELECT b FROM t1 USE INDEX (uinx) WHERE b=1;
b
1
SELECT a FROM t1 FORCE INDEX (inx,uinx) WHERE a=1;
a
1
ALTER TABLE t1 ENABLE KEYS;
SELECT a FROM t1 FORCE INDEX (inx) WHERE a=1;
a
1
DROP TABLE t1;
End of 5.0 tests
mysql-test/t/key.test
View file @
6d1fab66
...
...
@@ -432,3 +432,15 @@ ORDER BY c.b, c.d
;
DROP
TABLE
t1
,
t2
;
#
# Bug #20604: Test for disabled keys with aggregate functions and FORCE INDEX.
#
CREATE
TABLE
t1
(
a
TINYINT
,
KEY
(
a
)
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
);
ALTER
TABLE
t1
DISABLE
KEYS
;
EXPLAIN
SELECT
MAX
(
a
)
FROM
t1
FORCE
INDEX
(
a
);
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
.
mysql-test/t/myisam.test
View file @
6d1fab66
...
...
@@ -1145,4 +1145,20 @@ create table t3 (c1 int) engine=myisam pack_keys=default;
create
table
t4
(
c1
int
)
engine
=
myisam
pack_keys
=
2
;
drop
table
t1
,
t2
,
t3
;
#
# Bug#28476: force index on a disabled myisam index gives error 124
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
,
KEY
inx
(
a
),
UNIQUE
KEY
uinx
(
b
))
ENGINE
=
MyISAM
;
INSERT
INTO
t1
(
a
,
b
)
VALUES
(
1
,
1
),(
2
,
2
),(
3
,
3
),(
4
,
4
),(
5
,
5
);
SELECT
a
FROM
t1
FORCE
INDEX
(
inx
)
WHERE
a
=
1
;
ALTER
TABLE
t1
DISABLE
KEYS
;
SELECT
a
FROM
t1
FORCE
INDEX
(
inx
)
WHERE
a
=
1
;
SELECT
a
FROM
t1
USE
INDEX
(inx) WHERE a=1
;
SELECT
b
FROM
t1
FORCE
INDEX
(
uinx
)
WHERE
b
=
1
;
SELECT
b
FROM
t1
USE
INDEX
(uinx) WHERE b=1
;
SELECT
a
FROM
t1
FORCE
INDEX
(
inx
,
uinx
)
WHERE
a
=
1
;
ALTER
TABLE
t1
ENABLE
KEYS
;
SELECT
a
FROM
t1
FORCE
INDEX
(
inx
)
WHERE
a
=
1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
sql/sql_base.cc
View file @
6d1fab66
...
...
@@ -5167,7 +5167,12 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
get_key_map_from_key_list
(
&
map
,
table
,
table_list
->
use_index
);
if
(
map
.
is_set_all
())
DBUG_RETURN
(
1
);
table
->
keys_in_use_for_query
=
map
;
/*
Don't introduce keys in keys_in_use_for_query that weren't there
before. FORCE/USE INDEX should not add keys, it should only remove
all keys except the key(s) specified in the hint.
*/
table
->
keys_in_use_for_query
.
intersect
(
map
);
}
if
(
table_list
->
ignore_index
)
{
...
...
sql/sql_select.cc
View file @
6d1fab66
...
...
@@ -12246,10 +12246,11 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
LINT_INIT
(
ref_key_parts
);
/*
Check which keys can be used to resolve ORDER BY.
We must not try to use disabled keys
.
Keys disabled by ALTER TABLE ... DISABLE KEYS should have already
been taken into account
.
*/
usable_keys
=
table
->
s
->
keys_in_use
;
usable_keys
=
table
->
keys_in_use_for_query
;
DBUG_ASSERT
(
usable_keys
.
is_subset
(
table
->
s
->
keys_in_use
));
for
(
ORDER
*
tmp_order
=
order
;
tmp_order
;
tmp_order
=
tmp_order
->
next
)
{
...
...
sql/table.h
View file @
6d1fab66
...
...
@@ -137,7 +137,12 @@ typedef struct st_table_share
const
char
*
table_name
;
/* Table name (for open) */
const
char
*
path
;
/* Path to .frm file (from datadir) */
LEX_STRING
connect_string
;
key_map
keys_in_use
;
/* Keys in use for table */
/*
Set of keys in use, implemented as a Bitmap.
Excludes keys disabled by ALTER TABLE ... DISABLE KEYS.
*/
key_map
keys_in_use
;
key_map
keys_for_keyread
;
ulong
avg_row_length
;
/* create information */
ulong
raid_chunksize
;
...
...
@@ -208,7 +213,21 @@ struct st_table {
byte
*
record
[
2
];
/* Pointer to records */
byte
*
insert_values
;
/* used by INSERT ... UPDATE */
key_map
quick_keys
,
used_keys
,
keys_in_use_for_query
;
key_map
quick_keys
,
used_keys
;
/*
A set of keys that can be used in the query that references this
table
All indexes disabled on the table's TABLE_SHARE (see TABLE::s) will be
subtracted from this set upon instantiation. Thus for any TABLE t it holds
that t.keys_in_use_for_query is a subset of t.s.keys_in_use. Generally we
must not introduce any new keys here (see setup_tables).
The set is implemented as a bitmap.
*/
key_map
keys_in_use_for_query
;
key_map
merge_keys
;
KEY
*
key_info
;
/* data of keys in database */
Field
*
next_number_field
,
/* Set if next_number is activated */
...
...
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