-
Notifications
You must be signed in to change notification settings - Fork 709
sql: introduce invisible index #2971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Please help review this PR. @CaitinChen |
Co-authored-by: Caitin <34535727+CaitinChen@users.noreply.github.com>
Co-authored-by: Caitin <34535727+CaitinChen@users.noreply.github.com>
|
@CaitinChen Comments address, PTAL again, thanks! |
CaitinChen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@AilinKid PTAL |
| ## See also |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a MySQL compatibility difference in TiDB that should be documented. Because TiDB does not support the optimizer_switch, the following test case would allow the index to be used in MySQL - but will not work in TiDB:
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id INT NOT NULL PRIMARY KEY auto_increment,
b INT NOT NULL,
INDEX (b) INVISIBLE
);
INSERT INTO t1 VALUES (1, 1), (2,2),(3,3),(4,4),(5,5);
SELECT SLEEP(1);
ANALYZE TABLE t1;
SET optimizer_switch="use_invisible_indexes=on";
EXPLAIN SELECT * FROM t1 WHERE b = 3;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @wwar, we'll document this difference.
AilinKid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
/merge |
|
/run-all-tests |
What is changed, added or deleted? (Required)
Introduce invisible index.
Which TiDB version(s) do your changes apply to? (Required)
What is the related PR or file link(s)?