pingcap / pingcap/tidb

Cannot use RESOURCE_GROUP Optimizer hint in sql binding statement

Open
#57,462 3 comments 0 reactions 0 assignees View on GitHub
affects-8.5 component/pd may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/major type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

I cannot use RESOURCE_GROUP Optimizer hint in sql binding statement for limit the ttl job’s resource.

### 1. Minimal reproduce step (Required)

```
CREATE GLOBAL BINDING FOR
SELECT LOW_PRIORITY SQL_NO_CACHE `id`, `created_at`
FROM `test`.`olaptest1`
WHERE `created_at` < FROM_UNIXTIME(?)
ORDER BY `id`, `created_at` ASC
LIMIT ?
USING
SELECT /*+ RESOURCE_GROUP(rg_low_background) */ LOW_PRIORITY SQL_NO_CACHE `id`, `created_at`
FROM `test`.`olaptest1`
WHERE `created_at` < FROM_UNIXTIME(?)
ORDER BY `id`, `created_at` ASC
LIMIT ?
;
ERROR 8066 (HY000): Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc.
```

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

### 3. What did you see instead (Required)
ERROR 8066 (HY000): Optimizer hint can only be followed by certain keywords like SELECT, INSERT, etc.

### 4. What is your TiDB version? (Required)

v7.5.4

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.