foreign-data-wrapper

Setup Mysql Foreign Data Wrapper in Postgresql

蹲街弑〆低调 提交于 2019-12-10 10:16:19
问题 Could somebody help me understand how I would go about setting up postgresql's mysql_fdw? I'm looking at https://github.com/EnterpriseDB/mysql_fdw, and I not sure what the first step is. 回答1: You linked to the ODBC foreign data wrapper odbc_fdw . You can use it for MySQL, but if you just want MySQL you should use mysql_fdw instead. That way you don't have to mess with ODBC. Handily, the README for mysql_fdw contains detailed instructions for installation and configuration, so you should be

How to use index in foreign table SELECT MAX(id) query in PostgreSQL?

こ雲淡風輕ζ 提交于 2019-12-07 02:45:40
问题 I've got a foreign table (using postgresql_fdw foreign data wrapper) and I need to find maximum ID to copy all records. When I run SELECT MAX(id) FROM foreign_table it doesn't seem to be using index: Aggregate (cost=205.06..205.07 rows=1 width=4) (actual time=13999.535..13999.535 rows=1 loops=1) -> Foreign Scan on foreign_table (cost=100.00..197.75 rows=2925 width=4) (actual time=1.288..13632.768 rows=1849305 loops=1) Planning time: 0.087 ms Execution time: 14019.179 ms When I run the same

How to connect to localhost with postgres_fdw?

放肆的年华 提交于 2019-11-30 20:44:38
The idea is that I have local database named northwind , and with postgres_fdw I want to connect with another database named test on localhost (remote connection simulation, for situations like when table in my database is updated, do something in other database like save to history etc..). So I opened psql console and type: CREATE SERVER app_db FOREIGN DATA WRAPPER postgres_fdw OPTIONS (dbname 'test', host 'localhost:5432'); As i found in A Look at Foreign Data Wrappers link. Next I also follow the tutorial: CREATE USER MAPPING for postgres SERVER app_db OPTIONS (user 'postgres', password

Can PostgreSQL perform a join between two SQL Server stored procedures?

喜你入骨 提交于 2019-11-29 17:08:14
This question is related to an earlier one: Why is selecting from stored procedure not supported in relational databases? On SQL Server you cannot perform a join to (or a select from) a stored procedure (please note: a stored procedure is distinctly different from a function (table-valued function in SQL Server terminology) - with a function, you know the columns being returned at design time, but with a procedure, the specific columns to be returned are not known until runtime). With SQL Server, there does exist a "generally not allowed by DBA's" method where one can accomplish such a join: