Skip to content
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

pointGet and batchPointGet for global index has wrong plan #47513

Closed
L-maple opened this issue Oct 10, 2023 · 0 comments · Fixed by #47514
Closed

pointGet and batchPointGet for global index has wrong plan #47513

L-maple opened this issue Oct 10, 2023 · 0 comments · Fixed by #47514
Assignees
Labels
affects-7.5 feature/developing the related feature is in development severity/major sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.

Comments

@L-maple
Copy link
Contributor

L-maple commented Oct 10, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

enable-global-index = true in config.

use test;
CREATE TABLE t ( a int, b int, c int default 0)
						PARTITION BY RANGE (a) (
		PARTITION p0 VALUES LESS THAN (10),
		PARTITION p1 VALUES LESS THAN (20),
		PARTITION p2 VALUES LESS THAN (30),
		PARTITION p3 VALUES LESS THAN (40));
INSERT INTO t(a, b) values(1, 1), (2, 2), (3, 3), (15, 15), (25, 25), (35, 35);
ALTER TABLE t ADD UNIQUE INDEX idx(b);
ANALYZE TABLE t;
select * from t use index(idx) where b in (15, 25, 35);  -- panic
explain select * from t use index(idx) where b = 15;

2. What did you expect to see? (Required)

  • batchPointGet for global index should not panic;
  • pointGet for global index should go PointGetPlan, as this is more efficient than indexReader/indexScan;
image

3. What did you see instead (Required)

  • batchPointGet panic, meets "unique index must include all partition columns"
  • pointGet goes indexReader/indexLookUp
image

4. What is your TiDB version? (Required)

mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.5.0-alpha-44-ga01db41bd5
Edition: Community
Git Commit Hash: a01db41
Git Branch: HEAD
UTC Build Time: 2023-10-10 07:17:08
GoVersion: go1.21.0
Race Enabled: false
Check Table Before Drop: false
Store: unistore |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

@L-maple L-maple added the type/bug This issue is a bug. label Oct 10, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Oct 11, 2023
@Defined2014 Defined2014 added feature/developing the related feature is in development and removed may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.5 feature/developing the related feature is in development severity/major sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants