`RECOMMEND INDEX RUN FOR` reports "not updatable" for a DELETE on an ordinary base table
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```sql
CREATE TABLE t1 (a INT, b INT, c INT, d INT);
RECOMMEND INDEX RUN FOR 'DELETE FROM t1 WHERE d IS NULL';
```
`t1` is an ordinary base table, and the same table works fine when the identical predicate is wrapped in a `SELECT`:
```sql
RECOMMEND INDEX RUN FOR 'SELECT * FROM t1 WHERE d IS NULL'; -- works
```
### 2. What did you expect to see? (Required)
The [documented Limitations](https://docs.pingcap.com/tidb/stable/index-advisor/#limitations) only mention unsupported prepared statements, no index-deletion recommendations, and no UI — there is no mention that DML statements like `DELETE` / `UPDATE` are unsupported. So, `RECOMMEND INDEX RUN FOR 'DELETE FROM t1 WHERE d IS NULL'` should succeed and return an index recommendation (e.g. an index on `t1(d)`), the same way it does for the equivalent `SELECT * FROM t1 WHERE d IS NULL`.
### 3. What did you see instead (Required)
```
ERROR 1288 (HY000): The target table t1 of the DELETE is not updatable
```
### 4. What is your TiDB version? (Required)
```
tidb:4000 > SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v8.5.7
Edition: Community
Git Commit Hash: 202b7f47286a1109b5c957401d34c9358d130ae0
Git Branch: HEAD
UTC Build Time: 2026-07-07 08:10:56
GoVersion: go1.25.10
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.01 sec)
```
Contributor guide
Research direction
Reproduce the issue with the documented CREATE TABLE and RECOMMEND INDEX RUN FOR DELETE statements, then compare it with the equivalent SELECT. Trace the RECOMMEND INDEX RUN FOR handling for DML and verify that DELETE on an ordinary base table returns an index recommendation without the "not updatable" error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100