查看向量化GUC开发是否打开
默认向量化的GUC开关是打开,可以通过以下命令查看:
show vector.enable_vectorization;
使用向量化执行引擎
创建一个表,并使用向量化执行
postgres=# create table test(i int);
CREATE TABLE
postgres=# insert into test(i) values(1221);
INSERT 0 1
postgres=# insert into test(i) values(3);
INSERT 0 1
postgres=# explain select * from test;
QUERY PLAN
---------------------------------------------------------------------------
Vec Remote Subquery Scan on all (dn01) (cost=0.00..24.50 rows=1450 width=4)
-> Vec Seq Scan on test (cost=0.00..24.50 rows=1450 width=4)
(2 rows)
如果想切为非向量化,可以切guc参数。
postgres=# set vector.enable_vectorization to off;
SET
postgres=# explain select * from test;
QUERY PLAN
--------------------------------------------------------------------------
Remote Subquery Scan on all (dn01) (cost=0.00..24.50 rows=1450 width=4)
-> Seq Scan on test (cost=0.00..24.50 rows=1450 width=4)
(2 rows)