暂无图片
有使用 postgres_fdw 插件吗? 不知道效率怎么样。
我来答
分享
余俞
2021-09-29
有使用 postgres_fdw 插件吗? 不知道效率怎么样。

有使用 postgres_fdw 插件吗? 不知道效率怎么样。

我来答
添加附件
收藏
分享
问题补充
1条回答
默认
最新
Lucifer三思而后行
暂无图片

postgres_fdw为访问远程表提供了更透明和符合标准的语法,并且在许多情况下可以提供更好的性能。

postgres_fdw 是PG源码包自带的插件,所以直接去源码包进行编译安装即可,这里需要注意的是,在编译的时候,最好是用postgres用户来执行操作
如下:

[postgres@WAhaha_PG_10 postgres_fdw]$ pwd /opt/postgresql-10.6/contrib/postgres_fdw [postgres@WAhaha_PG_10 postgres_fdw]$ ls connection.c expected option.c postgres_fdw.c postgres_fdw.h sql deparse.c Makefile postgres_fdw--1.0.sql postgres_fdw.control shippable.c
复制

执行编译安装

[postgres@WAhaha_PG_10 postgres_fdw]$ USE_PGX=1 make install make -C ../../src/interfaces/libpq all make[1]: Entering directory `/opt/postgresql-10.6/src/interfaces/libpq' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/opt/postgresql-10.6/src/interfaces/libpq' gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I../../src/interfaces/libpq -I. -I. -I../../src/include -D_GNU_SOURCE -I/usr/include -c -o postgres_fdw.o postgres_fdw.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I../../src/interfaces/libpq -I. -I. -I../../src/include -D_GNU_SOURCE -I/usr/include -c -o option.o option.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I../../src/interfaces/libpq -I. -I. -I../../src/include -D_GNU_SOURCE -I/usr/include -c -o deparse.o deparse.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I../../src/interfaces/libpq -I. -I. -I../../src/include -D_GNU_SOURCE -I/usr/include -c -o connection.o connection.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I../../src/interfaces/libpq -I. -I. -I../../src/include -D_GNU_SOURCE -I/usr/include -c -o shippable.o shippable.c gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -shared -o postgres_fdw.so postgres_fdw.o option.o deparse.o connection.o shippable.o -L../../src/port -L../../src/common -L../../src/interfaces/libpq -lpq -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-8.4/lib',--enable-new-dtags /usr/bin/mkdir -p '/usr/pgsql/lib' /usr/bin/mkdir -p '/usr/pgsql/share/extension' /usr/bin/mkdir -p '/usr/pgsql/share/extension' /usr/bin/install -c -m 755 postgres_fdw.so '/usr/pgsql-8.4/lib/postgres_fdw.so' /usr/bin/install -c -m 644 ./postgres_fdw.control '/usr/pgsql-8.4/share/extension/' /usr/bin/install -c -m 644 ./postgres_fdw--1.0.sql '/usr/pgsql-8.4/share/extension/'
复制

其实这个过程就是使用 pg_config 的环境,将编译好的 .so 文件拷贝到 lib 动态库中,.control文 件放在extension 文件中。

暂无图片 评论
暂无图片 有用 0
打赏 0
回答交流
Markdown


请输入正文
提交
相关推荐
使用pgaudit插件的时候如果系统设置定义log_statement=ddl, 还可不可以针对某些user的insert这类做记录了?
回答 1
官网上面没有说明可以对某些用户的dml操作进行记录。https://github.com/pgaudit/pgaudit/blob/master/README.md
关于min_wal_size
回答 1
你是初始的数据库吧?多切几次wal,生成新的wal后观察
postgresql copy能设置复制多少行就提交一次吗?
回答 1
已采纳
貌似没有这个参数。不过你可以考虑把源文件(txt或csv)先分割成几份再导入。
postgreSQL 多模式下怎么实现表结构一致?
回答 1
使用触发器或者自定义任务比较元数据实现。
11在win上安装多个实例后自动启动端口监听失败,实例和Listener都需要重启,怎么破
回答 2
windowscmd可以使用下面命令查看端口占用进程:netstataon|findstr楼上大佬已经回答啦,同一个oracle版本的话,一个监听就够了。
postgreSQL中表17个字段,11个索引,正常吗?
回答 4
SQL优化能通过SQL改写实现优化的效果最好。盲目的加索引,查询速度是上来了,写可能就慢下来了。个人感觉,正常不正常,根据你的业务程序反应,业务程序读写都ok。表示正常。如果insert慢表示不正常。
postgresql 源码里面的contrib里面的sql文件,它们是在pg启动时会把所有的sql执行一遍吗?
回答 1
已采纳
并不是,contrib下面是插件源码,需要编译才能使用,需要用到某个插件时可以通过psql>createextensionxxx;来启用该插件。
为了解决OLTP,希望做分布式,支持分词,应该如何选数据库?PostgreSQL 或MySQL ?
回答 1
已采纳
oraclemysqlpg都支持分词。PG比MySQL在全文索引上好一些。
Postgresql 怎么设置主键id自增?
回答 2
已采纳
GENERATEDALWAYSAS(generationexpr)STORED此子句将列创建为generatedcolumn。列无法被写入,读取时将返回指定表达式的结果。关键字STORED表示将在写入
pg中某个库中存储过程有哪些,如何用数据字典中查到?
回答 2
psql使用快捷命令:\dfp
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~