本文共 1221 字,大约阅读时间需要 4 分钟。
GPORCA优化器是一款优秀的优化器,但是在某些场景下还是不如Postgres query optimizer 发挥稳定,
因此在session级别如何打开和关闭这个优化器.
以gpadmin用户登录master
查看是否已开启?
~]$ gpconfig -s optimizer Values on all segments are consistentGUC : optimizerMaster value: offSegment value: off
打开
~]$ gpconfig -c optimizer -v on20210324:09:52:30:044766 gpconfig:gptest01:gpadmin-[INFO]:-completed successfully with parameters '-c optimizer -v on'
生效
~]$ gpstop -u20210324:09:52:34:045084 gpstop:gptest01:gpadmin-[INFO]:-Starting gpstop with args: -u20210324:09:52:34:045084 gpstop:gptest01:gpadmin-[INFO]:-Gathering information and validating the environment...20210324:09:52:34:045084 gpstop:gptest01:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information20210324:09:52:34:045084 gpstop:gptest01:gpadmin-[INFO]:-Obtaining Segment details from master...20210324:09:52:35:045084 gpstop:gptest01:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 6.2.1 build commit:d90ac1a1b983b913b3950430d4d9e47ee8827fd4'20210324:09:52:35:045084 gpstop:gptest01:gpadmin-[INFO]:-Signalling all postmaster processes to reload
# ALTER DATABASE qmstst SET OPTIMIZER = ON ;ALTER DATABASE
set optimizer = on ; session级别可控制
在执行update前打开 执行完之后关闭。
转载地址:http://nhhqj.baihongyu.com/