PostgreSQL 跨服务器查询?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2856399/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PostgreSQL cross server query?
提问by AlexRednic
Is there a way that I might query a database located on "Server 2" and get my data in "Server 1" ? That is return a set of records from a remote server to my local one.
有没有办法可以查询位于“服务器 2”上的数据库并在“服务器 1”中获取我的数据?那是将一组记录从远程服务器返回到我的本地服务器。
PS: Not cross database query on same server because I know how to do that with dblink.
PS:不要在同一台服务器上进行跨数据库查询,因为我知道如何使用 dblink 来做到这一点。
Update:great ty.
更新:太棒了。
http://www.postgresonline.com/journal/index.php?/archives/44-Using-DbLink-to-access-other-PostgreSQL-Databases-and-Servers.htmlworks like a charm. My bust was that I didn't see it on the dblink documentation on postgresql website.
http://www.postgresonline.com/journal/index.php?/archives/44-Using-DbLink-to-access-other-PostgreSQL-Databases-and-Servers.html就像一个魅力。我的问题是我没有在 postgresql 网站上的 dblink 文档中看到它。
采纳答案by yozey
Apparently dblink can be used to query other servers - Using DbLink to access other PostreSQL Databases and Servers
显然 dblink 可用于查询其他服务器 -使用 DbLink 访问其他 PostreSQL 数据库和服务器
回答by radiospiel
this is old - these days one would use the postgres_fdw module instead: https://www.postgresql.org/docs/9.3/static/postgres-fdw.html
这是旧的 - 现在人们会改用 postgres_fdw 模块:https: //www.postgresql.org/docs/9.3/static/postgres-fdw.html