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
052edd98
Commit
052edd98
authored
Mar 18, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test of range optimizer in InnoDB
parent
7761805e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
2 deletions
+95
-2
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+32
-1
mysql-test/t/innodb.test
mysql-test/t/innodb.test
+33
-1
sql/ha_myisam.cc
sql/ha_myisam.cc
+30
-0
No files found.
mysql-test/r/innodb.result
View file @
052edd98
drop table if exists t1,t2;
drop table if exists t1,t2
,t3
;
create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb;
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
select id, code, name from t1 order by id;
...
...
@@ -1091,3 +1091,34 @@ SELECT * from t1;
id
3
DROP TABLE t1,t2;
set autocommit=0;
CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB;
CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) TYPE=InnoDB;
CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) TYPE=InnoDB;
INSERT INTO t3 VALUES("my-test-1", "my-test-2");
COMMIT;
INSERT INTO t1 VALUES("this-key", "will disappear");
INSERT INTO t2 VALUES("this-key", "will also disappear");
DELETE FROM t3 WHERE id1="my-test-1";
SELECT * FROM t1;
id value
this-key will disappear
SELECT * FROM t2;
id value
this-key will also disappear
SELECT * FROM t3;
id1 id2
ROLLBACK;
SELECT * FROM t1;
id value
SELECT * FROM t2;
id value
SELECT * FROM t3;
id1 id2
my-test-1 my-test-2
SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
id1 id2
my-test-1 my-test-2
COMMIT;
set autocommit=1;
DROP TABLE t1,t2,t3;
mysql-test/t/innodb.test
View file @
052edd98
...
...
@@ -4,7 +4,7 @@
# Small basic test with ignore
#
drop
table
if
exists
t1
,
t2
;
drop
table
if
exists
t1
,
t2
,
t3
;
create
table
t1
(
id
int
unsigned
not
null
auto_increment
,
code
tinyint
unsigned
not
null
,
name
char
(
20
)
not
null
,
primary
key
(
id
),
key
(
code
),
unique
(
name
))
type
=
innodb
;
insert
into
t1
(
code
,
name
)
values
(
1
,
'Tim'
),
(
1
,
'Monty'
),
(
2
,
'David'
),
(
2
,
'Erik'
),
(
3
,
'Sasha'
),
(
3
,
'Jeremy'
),
(
4
,
'Matt'
);
...
...
@@ -726,3 +726,35 @@ SELECT * from t1;
UPDATE
t1
,
t2
SET
t1
.
id
=
t1
.
id
+
1
where
t1
.
id
!=
t2
.
id
;
SELECT
*
from
t1
;
DROP
TABLE
t1
,
t2
;
#
# Test of range_optimizer
#
set
autocommit
=
0
;
CREATE
TABLE
t1
(
id
CHAR
(
15
)
NOT
NULL
,
value
CHAR
(
40
)
NOT
NULL
,
PRIMARY
KEY
(
id
))
TYPE
=
InnoDB
;
CREATE
TABLE
t2
(
id
CHAR
(
15
)
NOT
NULL
,
value
CHAR
(
40
)
NOT
NULL
,
PRIMARY
KEY
(
id
))
TYPE
=
InnoDB
;
CREATE
TABLE
t3
(
id1
CHAR
(
15
)
NOT
NULL
,
id2
CHAR
(
15
)
NOT
NULL
,
PRIMARY
KEY
(
id1
,
id2
))
TYPE
=
InnoDB
;
INSERT
INTO
t3
VALUES
(
"my-test-1"
,
"my-test-2"
);
COMMIT
;
INSERT
INTO
t1
VALUES
(
"this-key"
,
"will disappear"
);
INSERT
INTO
t2
VALUES
(
"this-key"
,
"will also disappear"
);
DELETE
FROM
t3
WHERE
id1
=
"my-test-1"
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
SELECT
*
FROM
t3
;
ROLLBACK
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t2
;
SELECT
*
FROM
t3
;
SELECT
*
FROM
t3
WHERE
id1
=
"my-test-1"
LOCK
IN
SHARE
MODE
;
COMMIT
;
set
autocommit
=
1
;
DROP
TABLE
t1
,
t2
,
t3
;
sql/ha_myisam.cc
View file @
052edd98
...
...
@@ -1242,6 +1242,35 @@ longlong ha_myisam::get_auto_increment()
}
/*
Find out how many rows there is in the given range
SYNOPSIS
records_in_range()
inx Index to use
start_key Start of range. Null pointer if from first key
start_key_len Length of start key
start_search_flag Flag if start key should be included or not
end_key End of range. Null pointer if to last key
end_key_len Length of end key
end_search_flag Flag if start key should be included or not
NOTES
start_search_flag can have one of the following values:
HA_READ_KEY_EXACT Include the key in the range
HA_READ_AFTER_KEY Don't include key in range
end_search_flag can have one of the following values:
HA_READ_BEFORE_KEY Don't include key in range
HA_READ_AFTER_KEY Include all 'end_key' values in the range
RETURN
HA_POS_ERROR Something is wrong with the index tree.
0 There is no matching keys in the given range
number > 0 There is approximately 'number' matching rows in
the range.
*/
ha_rows
ha_myisam
::
records_in_range
(
int
inx
,
const
byte
*
start_key
,
uint
start_key_len
,
enum
ha_rkey_function
start_search_flag
,
...
...
@@ -1256,6 +1285,7 @@ ha_rows ha_myisam::records_in_range(int inx,
end_search_flag
);
}
int
ha_myisam
::
ft_read
(
byte
*
buf
)
{
int
error
;
...
...
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