
# 优化器GUC参数的Hint
#### 功能描述
设置本次查询执行内生效的查询优化相关GUC参数。hint的推荐使用场景可以参考各guc参数的说明，此处不作赘述。
#### 语法格式
```
set( [@queryblock] param value)
```
#### 参数说明
- @queryblock 见[指定Hint所处于的查询块Queryblock](https://support.huaweicloud.com/centralized-devg-v3-gaussdb/gaussdb-42-0294.html#ZH-CN_TOPIC_0000002235339121)，可省略，表示在当前查询块生效，该hint只在指定为最外层的queryblock时才会生效。
- **param**表示参数名。
- **value**表示参数的取值。
- 目前支持使用Hint设置生效的参数有
  - 布尔类： enable_bitmapscan、enable_hashagg、enable_hashjoin、enable_indexscan、enable_indexonlyscan、enable_material、enable_mergejoin、enable_nestloop、enable_index_nestloop、enable_seqscan、enable_sort、enable_tidscan、partition_iterator_elimination、partition_page_estimation、enable_functional_dependency、var_eq_const_selectivity、enable_inner_unique_opt
    
  
  - 整型类： query_dop
    
  
  - 浮点类： cost_weight_index、default_limit_rows、seq_page_cost、random_page_cost、cpu_tuple_cost、cpu_index_tuple_cost、cpu_operator_cost、effective_cache_size
    
   
![](https://support.huaweicloud.com/centralized-devg-v3-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
- 设置不在白名单中的参数，参数取值不合法，或hint语法错误时，不会影响查询执行的正确性。使用explain(verbose on)执行可以看到hint解析错误的报错提示。
- GUC参数的hint只在最外层查询生效，子查询内的GUC参数hint不生效。
- 视图定义内的GUC参数hint不生效。
- CREATE TABLE ... AS ... 查询最外层的GUC参数hint可以生效。
 
