Can /*+ MEMORY_QUOTA(2 GB)*/ only be placed in the outermost select? Are there any alternatives?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 使用/+ MEMORY_QUOTA(2 GB)/只能放在最外层select吗?有没有什么替代方案?

| username: Jjjjayson_zeng

[TiDB Usage Environment] Production Environment
[TiDB Version]
[Reproduction Path] What operations were performed when the problem occurred
[Encountered Problem: Problem Phenomenon and Impact]
[Resource Configuration] Go to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page
[Attachment: Screenshot/Log/Monitoring]



As shown in the picture, it works outside but not inside. Is there any solution?

| username: Kongdom | Original post link

:thinking: Shouldn’t this be placed at the outermost layer?
You can consider modifying the system variable tidb_mem_quota_query.

| username: 裤衩儿飞上天 | Original post link

TiDB currently supports two types of Optimizer Hints based on their scope of effect: the first type is effective within the query block scope, such as /*+ HASH_AGG() */; the second type is effective within the entire query scope, such as /*+ MEMORY_QUOTA(1024 MB)*/.

For hints effective within the query block scope, refer to: Optimizer Hints | PingCAP Documentation Center

| username: Kongdom | Original post link

:+1: :+1: :+1: It turns out that it also supports query block range effective Hint.

| username: zhanggame1 | Original post link

This hint can only be placed outside.

| username: Soysauce520 | Original post link

Specify the block with sel?

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.