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

时间:2023-11-01 16:22:50

示例

强制使用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-v2-opengauss/gaussdb-v5r2c10-0355.html