The FDW practice of PostgreSQL

Source: Internet
Author: User
Tags postgresql


oracle_fdw:http://francs3.blog.163.com/blog/static/4057672720122354546425/



Postgres_fdw:http://www.postgresql.org/docs/9.4/static/postgres-fdw.html

The POSTGRES_FDW is used to access the external PostgreSQL server.

Examples of the steps are listed as follows:

    1. Configure the external database server to allow remote access.

    2. In the local database server, create the external data table:

postgres=# create extension postgres_fdw; create extensionpostgres=# create server foreign_server foreign data  wrapper postgres_fdw options  (host  ' 192.168.100.232 ',port  ' 5432 ', dbname  ' Postgres '); create serverpostgres=# create user postgres_fdw superuser password  ' Postgres '; Create rolepostgres=# create user mapping for postgres_fdw  server  foreign_server options  (user  ' postgres ', password  ' postgres ');  create  USER MAPPINGPOSTGRES=# CREATE FOREIGN TABLE LYY_FDW (id int, name  varchar) server foreign_server options  (schema_name  ' public ',table_name  ' lyy '); create foreign table--The External data table is created and queried (data for the Public.lyy table in the external server is available): postgres=# select *  from postgres.lyy_fdw; id | name ----+------&Nbsp; 1 | lily  2 | lucy 11 | hhhh (3 rows) 


3. Thereafter, the corresponding external data table data in the local server changes whenever the corresponding table data in the external database server changes.








The FDW practice of PostgreSQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.