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

时间:2024-11-13 14:46:38

示例

强制使用Custom Plan:

1
2
3
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:

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

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

support.huaweicloud.com/centralized-devg-v8-gaussdb/gaussdb-42-0305.html