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

时间:2023-11-01 16:18:32

示例

强制使用Custom Plan

123
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/centralized-devg-v3-opengauss/gaussdb-12-0302.html