resource group hint cannot work well in prepare/excute statement
- 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)
```
create user 'user1';
GRANT ALL PRIVILEGES ON *.* TO 'user1'@'%';
create resource group if not exists rg1 RU_PER_SEC=10000000;
create resource group if not exists rp RU_PER_SEC=2000000;
alter user 'user1' resource group rg1;
```
change sysbench `oltp_common.lua` to add a hint.
```
local stmt_defs = {
point_selects = {
"SELECT /*+ RESOURCE_GROUP(tp) */ c FROM sbtest%u WHERE id=?",
t.INT},
```
run workload
```
sysbench --mysql-user=user1 --mysql-host=127.0.0.1 --mysql-port=4000 --table-size=10000 --time=360 oltp_point_select --tables=2 prepare
```
### 2. What did you expect to see? (Required)
the expected resource group `tp`.
### 3. What did you see instead (Required)
the resource group almos in `rg1`.

### 4. What is your TiDB version? (Required)
above 7.6
Contributor guide
Research direction
Reproduce the behavior with the SQL setup, the RESOURCE_GROUP hint in sysbench's oltp_common.lua, and the prepare command shown in the report. Compare the selected resource group for prepared versus non-prepared execution, then trace the relevant TiDB resource-group handling. Done means the prepared statement uses the hinted group tp rather than the user's default group rg1.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, mysql, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100