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
5625988c
Commit
5625988c
authored
Sep 02, 2004
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-4.0
into rurik.mysql.com:/home/igor/dev/mysql-4.0-0
parents
f7bc60e0
f888026f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
3 deletions
+49
-3
mysql-test/r/key_primary.result
mysql-test/r/key_primary.result
+1
-1
mysql-test/r/null_key.result
mysql-test/r/null_key.result
+1
-1
mysql-test/r/select.result
mysql-test/r/select.result
+16
-0
mysql-test/t/select.test
mysql-test/t/select.test
+21
-0
sql/sql_select.cc
sql/sql_select.cc
+10
-1
No files found.
mysql-test/r/key_primary.result
View file @
5625988c
...
@@ -13,7 +13,7 @@ t1
...
@@ -13,7 +13,7 @@ t1
AB%
AB%
describe select * from t1 where t1="ABC";
describe select * from t1 where t1="ABC";
table type possible_keys key key_len ref rows Extra
table type possible_keys key key_len ref rows Extra
t1 const PRIMARY PRIMARY 3 const 1
t1 const PRIMARY PRIMARY 3 const 1
Using index
describe select * from t1 where t1="ABCD";
describe select * from t1 where t1="ABCD";
Comment
Comment
Impossible WHERE noticed after reading const tables
Impossible WHERE noticed after reading const tables
...
...
mysql-test/r/null_key.result
View file @
5625988c
...
@@ -12,7 +12,7 @@ table type possible_keys key key_len ref rows Extra
...
@@ -12,7 +12,7 @@ table type possible_keys key key_len ref rows Extra
t1 ref a,b a 9 const,const 1 Using where; Using index
t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a=2 and b = 2;
explain select * from t1 where a=2 and b = 2;
table type possible_keys key key_len ref rows Extra
table type possible_keys key key_len ref rows Extra
t1 const a,b a 9 const,const 1
t1 const a,b a 9 const,const 1
Using index
explain select * from t1 where a<=>b limit 2;
explain select * from t1 where a<=>b limit 2;
table type possible_keys key key_len ref rows Extra
table type possible_keys key key_len ref rows Extra
t1 index NULL a 9 NULL 12 Using where; Using index
t1 index NULL a 9 NULL 12 Using where; Using index
...
...
mysql-test/r/select.result
View file @
5625988c
...
@@ -2327,3 +2327,19 @@ select * from t2,t3 where t2.s = t3.s;
...
@@ -2327,3 +2327,19 @@ select * from t2,t3 where t2.s = t3.s;
s s
s s
two two
two two
drop table t1, t2, t3;
drop table t1, t2, t3;
CREATE TABLE t1 (
i int(11) NOT NULL default '0',
c char(10) NOT NULL default '',
PRIMARY KEY (i),
UNIQUE KEY c (c)
) TYPE=MyISAM;
INSERT INTO t1 VALUES (1,'a');
INSERT INTO t1 VALUES (2,'b');
INSERT INTO t1 VALUES (3,'c');
EXPLAIN SELECT i FROM t1 WHERE i=1;
table type possible_keys key key_len ref rows Extra
t1 const PRIMARY PRIMARY 4 const 1 Using index
EXPLAIN SELECT i FROM t1 WHERE i=1;
table type possible_keys key key_len ref rows Extra
t1 const PRIMARY PRIMARY 4 const 1 Using index
DROP TABLE t1;
mysql-test/t/select.test
View file @
5625988c
...
@@ -1874,3 +1874,24 @@ select * from t3 where s = 'one';
...
@@ -1874,3 +1874,24 @@ select * from t3 where s = 'one';
select
*
from
t1
,
t2
where
t1
.
s
=
t2
.
s
;
select
*
from
t1
,
t2
where
t1
.
s
=
t2
.
s
;
select
*
from
t2
,
t3
where
t2
.
s
=
t3
.
s
;
select
*
from
t2
,
t3
where
t2
.
s
=
t3
.
s
;
drop
table
t1
,
t2
,
t3
;
drop
table
t1
,
t2
,
t3
;
#
# Covering index is mentioned in EXPLAIN output for const tables (bug #5333)
#
CREATE
TABLE
t1
(
i
int
(
11
)
NOT
NULL
default
'0'
,
c
char
(
10
)
NOT
NULL
default
''
,
PRIMARY
KEY
(
i
),
UNIQUE
KEY
c
(
c
)
)
TYPE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
,
'a'
);
INSERT
INTO
t1
VALUES
(
2
,
'b'
);
INSERT
INTO
t1
VALUES
(
3
,
'c'
);
EXPLAIN
SELECT
i
FROM
t1
WHERE
i
=
1
;
EXPLAIN
SELECT
i
FROM
t1
WHERE
i
=
1
;
DROP
TABLE
t1
;
\ No newline at end of file
sql/sql_select.cc
View file @
5625988c
...
@@ -4907,6 +4907,15 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
...
@@ -4907,6 +4907,15 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
}
}
else
else
{
{
if
(
!
table
->
key_read
&&
(
table
->
used_keys
&
((
key_map
)
1
<<
tab
->
ref
.
key
))
&&
!
table
->
no_keyread
&&
(
int
)
table
->
reginfo
.
lock_type
<=
(
int
)
TL_READ_HIGH_PRIORITY
)
{
table
->
key_read
=
1
;
table
->
file
->
extra
(
HA_EXTRA_KEYREAD
);
tab
->
index
=
tab
->
ref
.
key
;
}
if
((
error
=
join_read_const
(
tab
)))
if
((
error
=
join_read_const
(
tab
)))
{
{
tab
->
info
=
"unique row not found"
;
tab
->
info
=
"unique row not found"
;
...
@@ -7623,7 +7632,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
...
@@ -7623,7 +7632,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
sprintf
(
buff3
,
"%.0f"
,
join
->
best_positions
[
i
].
records_read
);
sprintf
(
buff3
,
"%.0f"
,
join
->
best_positions
[
i
].
records_read
);
item_list
.
push_back
(
new
Item_string
(
buff3
,
strlen
(
buff3
)));
item_list
.
push_back
(
new
Item_string
(
buff3
,
strlen
(
buff3
)));
my_bool
key_read
=
table
->
key_read
;
my_bool
key_read
=
table
->
key_read
;
if
(
tab
->
type
==
JT_NEXT
&&
if
(
(
tab
->
type
==
JT_NEXT
||
tab
->
type
==
JT_CONST
)
&&
((
table
->
used_keys
&
((
key_map
)
1
<<
tab
->
index
))))
((
table
->
used_keys
&
((
key_map
)
1
<<
tab
->
index
))))
key_read
=
1
;
key_read
=
1
;
...
...
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