-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
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;

3. What did you see instead (Required)
- batchPointGet panic, meets "unique index must include all partition columns"
- pointGet goes indexReader/indexLookUp

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)