mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Test of range optimizer in InnoDB
sql/ha_myisam.cc: Added function comment
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user