---
title: 安装GPORCA
description: "GPORCA扩展了Greenplum数据库传统优化器的规划和优化能力。 GPORCA是可扩展的，它能在多核环境中获得更好的性能。Greenplum数据库默认使用GPORCA来生成查询计划。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdbs/ecosystemEnable/Greenplum/kunpenggreenplum_02_0013.html
sourcePath: /source/zh/kunpengdbs/ecosystemEnable/Greenplum/kunpenggreenplum_02_0013.html
indexId: bee08ca13f7c8be3fee01602b5e512ee3847955985768cf93cdb017b06d2514c77
---
# 安装GPORCA

GPORCA扩展了Greenplum数据库传统优化器的规划和优化能力。 GPORCA是可扩展的，它能在多核环境中获得更好的性能。Greenplum数据库默认使用GPORCA来生成查询计划。

安装Greenplum 5.11.3时建议使用GPORCA 3.1.0，安装Greenplum 6.0.0时建议使用GPORCA 3.65.3，安装Greenplum 6.12.1时可以不安装GPORCA。下文以安装GPORCA 3.1.0为例进行说明。

1. 进入目录。
  1 cd /opt/tool

2. 下载GPORCA源码(https://gitee.com/Mr.Lin/gporca/tree/v3.1.0)并上传至“/opt/tool”。
3. 修改“CStackDescriptor.cpp”配置文件。

  a. 打开文件。
    1 vim gporca/libgpos/src/common/CStackDescriptor.cpp

  b. 按“i”进入编辑模式，注释第167行。
  c. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
4. 编译安装GPORCA。
  1 2 3 4 mkdir gporca/build cd gporca/build cmake -GNinja .. ninja install

5. 添加“/usr/local/lib”到“/etc/ld.so.conf”文件。
  1 2 3 echo /usr/local/lib >> /etc/ld.so.conf echo /usr/local/lib64 >> /etc/ld.so.conf ldconfig
