Failed to add foreign key due to "ERROR 8175 (HY000): Your query has been cancelled"
- 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)
1. create tidb cluster v8.5.4 ( tidb * 2 on 16c32g, tikv * 3 on 16c32g )
2. br restore db benchmarksql-tpcc-1k
3. delete all foreign key
4. `set global tidb_mem_quota_query=84825604096;`
5. add foreign key `h_customer_fkey`
```sql
ALTER TABLE `bmsql_history` ADD CONSTRAINT `h_customer_fkey` FOREIGN KEY (`h_c_w_id`, `h_c_d_id`, `h_c_id`) REFERENCES `bmsql_customer` (`c_w_id`, `c_d_id`, `c_id`)
```
### 2. What did you expect to see? (Required)
no error.
### 3. What did you see instead (Required)
```
ERROR 8175 (HY000): Your query has been cancelled due to exceeding the allowed memory limit for a single SQL query. Please try narrowing your query scope or increase the tidb_mem_quota_query limit and try again.[conn=0]
```
### 4. What is your TiDB version? (Required)
v8.5.4
Contributor guide
Assessment
This issue has not been assessed yet.