云数据库 GaussDB-Custom Plan和Generic Plan选择的Hint:示例

时间:2025-02-12 15:08:11

示例

强制使用Custom Plan:

1234
set enable_fast_query_shipping = off;create table t (a int, b int, c int);prepare p as select /*+ use_cplan */ * from t where a = $1;explain execute p(1);

计划如下,可以看到过滤条件为入参的实际值,即此计划为Custom Plan。

强制使用Generic Plan:

123
deallocate p;prepare p as select /*+ use_gplan */ * from t where a = $1;explain execute p(1);

计划如下,可以看到过滤条件为待填充的入参,即此计划为Generic Plan。

support.huaweicloud.com/distributed-devg-v8-gaussdb/gaussdb-12-0286.html