GaussDB-指定不使用全局计划缓存的Hint

46 阅读1分钟

GaussDB-指定不使用全局计划缓存的Hint

功能描述

全局计划缓存打开时,可以通过no_gpc hint来强制单个查询语句不在全局共享计划缓存,只保留会话生命周期的计划缓存。

语法格式

| ``` no_gpc

| --------------- |

![](https://p6-xtjj-sign.byteimg.com/tos-cn-i-73owjymdk6/0b29cf6107ba46cfa216736c1a10d4ef~tplv-73owjymdk6-jj-mark-v1:0:0:0:0:5o6Y6YeR5oqA5pyv56S-5Yy6IEAgamVycnl3YW5nMTk4Mw==:q75.awebp?rk3s=f64ab15b&x-expires=1772004900&x-signature=5J56Y7DqQubZhf2Wa5fPG7oNtxA%3D)

本参数仅在enable_global_plancache=on时对PBE执行的语句生效。

#### 示例

gaussdb=# deallocate all; DEALLOCATE ALL gaussdb=# prepare p1 as insert /*+ no_gpc */ into t1 select c1,c2 from t2 where c1=$1; PREPARE gaussdb=# execute p1(3); INSERT 0 1 gaussdb=# select * from dbe_perf.global_plancache_status where schema_name='public' order by 1,2; nodename | query | refcount | valid | databaseid | schema_name | params_num | func_id | pkg_id | stmt_id ----------+-------+----------+-------+------------+-------------+------------+---------+--------+--------- (0 rows)


dbe_perf.global_plancache_status视图中无结果即没有计划被全局缓存。

更多详情请参考GaussDB 文档中心:<https://doc.hcs.huawei.com/db/zh-cn/gaussdbqlh/24.1.30/productdesc/qlh_03_0001.html>