云数据库 GAUSSDB-session级事务下推及相关参数:示例

时间:2024-11-01 17:14:27

示例

gaussdb=# set log_min_messages = debug2;
gaussdb=# set logging_module = 'on(opt_choice)';
gaussdb=# create table t1(a int ,b int);
gaussdb=# prepare x(int) as select * from t1;
gaussdb=# explain execute x(10);
NOTICE:  [Choosing C/G/A Plan]: GPlan, reason: Using pbe optimization.
NOTICE:  [Choosing C/G/A Plan]: CPlan, reason: First 5 times using CPlan.
                    QUERY PLAN                    
--------------------------------------------------
 Data Node Scan  (cost=0.00..0.00 rows=0 width=0)
   Node/s: All datanodes
(2 rows)
gaussdb=# DEALLOCATE x;
gaussdb=# prepare x(int) as select * from t1;
gaussdb=# set session_type=single_node;
gaussdb=# set exec_target_node=datanode1;
gaussdb=# explain execute x(10);
NOTICE:  [Choosing C/G/A Plan]: GPlan, reason: Using pbe optimization.
NOTICE:  [Choosing C/G/A Plan]: GPlan, reason: Using pbe optimization.
                    QUERY PLAN                    
--------------------------------------------------
 Data Node Scan  (cost=0.00..0.00 rows=0 width=0)
   Node/s: datanode1
(2 rows)
gaussdb=# DEALLOCATE x;
gaussdb=# drop table t1;
support.huaweicloud.com/distributed-devg-v8-gaussdb/gaussdb-12-1776.html