-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Reasons: The current primary key index is not supported for range queries
- Loading branch information
1 parent
925f350
commit ee37e0b
Showing
6 changed files
with
74 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
USE test; | ||
set global tianmu_index_search=on; | ||
DROP TABLE IF EXISTS tt1,tt2; | ||
CREATE TABLE tt1(id INT PRIMARY KEY,name VARCHAR(5),copy_id INT) ENGINE=TIANMU; | ||
CREATE TABLE tt2(id INT PRIMARY KEY,name VARCHAR(5),copy_id INT) ENGINE=TIANMU; | ||
INSERT INTO tt1 VALUES(1,'AAA',1),(2,'AAA',2),(3,'BBB',3),(4,'BBB',4),(5,'CCC',5); | ||
INSERT INTO tt2 VALUES(1,'BBB',1),(2,'BBB',2),(3,'CCC',3),(4,'CCC',4),(5,'DDD',5); | ||
SELECT * FROM tt1 WHERE EXISTS (SELECT 1 FROM tt2 WHERE tt1.id = tt2.id AND name='BBB'); | ||
id name copy_id | ||
1 AAA 1 | ||
2 AAA 2 | ||
SELECT * FROM tt1 WHERE NOT EXISTS (SELECT 1 FROM tt2 WHERE tt1.id = tt2.id AND name='BBB'); | ||
id name copy_id | ||
3 BBB 3 | ||
4 BBB 4 | ||
5 CCC 5 | ||
set global tianmu_index_search=off; | ||
DROP TABLE tt1,tt2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--source include/have_tianmu.inc | ||
|
||
USE test; | ||
|
||
--disable_warnings | ||
|
||
## enable the tianmu primary key index | ||
|
||
set global tianmu_index_search=on; | ||
|
||
## DDL | ||
|
||
DROP TABLE IF EXISTS tt1,tt2; | ||
|
||
CREATE TABLE tt1(id INT PRIMARY KEY,name VARCHAR(5),copy_id INT) ENGINE=TIANMU; | ||
CREATE TABLE tt2(id INT PRIMARY KEY,name VARCHAR(5),copy_id INT) ENGINE=TIANMU; | ||
|
||
## insert data | ||
|
||
INSERT INTO tt1 VALUES(1,'AAA',1),(2,'AAA',2),(3,'BBB',3),(4,'BBB',4),(5,'CCC',5); | ||
INSERT INTO tt2 VALUES(1,'BBB',1),(2,'BBB',2),(3,'CCC',3),(4,'CCC',4),(5,'DDD',5); | ||
|
||
## subquery EXISTS | ||
|
||
SELECT * FROM tt1 WHERE EXISTS (SELECT 1 FROM tt2 WHERE tt1.id = tt2.id AND name='BBB'); | ||
|
||
## subquery NOT EXISTS | ||
|
||
SELECT * FROM tt1 WHERE NOT EXISTS (SELECT 1 FROM tt2 WHERE tt1.id = tt2.id AND name='BBB'); | ||
|
||
## disable the tianmu primary key index | ||
|
||
set global tianmu_index_search=off; | ||
|
||
## clean test table | ||
|
||
DROP TABLE tt1,tt2; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters