Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do databases besides Postgres have features comparable to foreign data wrappers?

I'm very excited by several of the more recently-added Postgres features, such as foreign data wrappers. I'm not aware of any other RDBMS having this feature, but before I try to make the case to my main client that they should begin preferring Postgres over their current cocktail of RDBMSs, and include in my case that no other database can do this, I'd like to verify that.

I've been unable to find evidence of any other database supporting SQL/MED, and things like this short note stating that Oracle does not support SQL/MED.

The main thing that gives me doubt is a statement on http://wiki.postgresql.org/wiki/SQL/MED:

SQL/MED is Management of External Data, a part of the SQL standard that deals with how a database management system can integrate data stored outside the database.

If FDWs are based on SQL/MED, and SQL/MED is an open standard, then it seems likely that other RDBMSs have implemented it too.

TL;DR:

Does any database besides Postgres support SQL/MED?

like image 523
iconoclast Avatar asked May 01 '14 16:05

iconoclast


People also ask

What are foreign data wrappers?

A foreign data wrapper is a library that can communicate with an external data source, hiding the details of connecting to the data source and obtaining data from it. There are some foreign data wrappers available as contrib modules; see Appendix F.

Is PostgreSQL the best database?

PostgreSQL's speed, security and robustness make it suitable for 99% of applications, so it's a great starting place for any application. Maybe, just maybe, other systems have some other magic you need. But almost certainly, PostgreSQL, the “World's Most Advanced Open Source Database” has everything you need already.

Why PostgreSQL is the best database?

For several past decades, a leader among database options has been PostgreSQL. It is an advanced open-source object-relational system which applies SQL language. Postgres allows you to store large and sophisticated data safely.

Which is better SQL or PostgreSQL?

Despite the overwhelming popularity of MySQL, PostgreSQL may be a better choice because its syntax most closely conforms to Standard SQL. This means that you can easily translate your skills to other database management systems such as MySQL or SQLite.


2 Answers

  • IBM DB2 claims compliance with SQL/MED (including full FDW API);
  • MySQL's FEDERATED storage engine can connect to another MySQL database, but NOT to other RDBMSs;
  • MariaDB's CONNECT engine allows access to various file formats (CSV, XML, Excel, etc), gives access to "any" ODBC data sources (Oracle, DB2, SQLServer, etc) and can access data on the storage engines MyIsam and InnoDB.
  • Farrago has some of it too;
  • PostgreSQL implements parts of it (notably it does not implement routine mappings, and has a simplified FDW API). It is usable as readeable since PG 9.1 and writeable since 9.3, and prior to that there was the DBI-Link.

PostgreSQL communities have a plenty of nice FDW like noSQL FDW (couchdb_fdw, mongo_fdw, redis_fdw), Multicorn (for using Python output instead of C for the wrapper per se), or the nuts PGStrom (which uses GPU for some operations!)

like image 113
Vitor Tyburski Avatar answered Oct 25 '22 03:10

Vitor Tyburski


SQL Server has the concept of Linked Servers (http://technet.microsoft.com/en-us/library/ms188279.aspx), which allows you to connect to external data sources (Oracle, other SQL instances, Active Directory, File system data via the Indexing Service provider, etc.) and, if you really needed to, you can create your own Providers that can be used by a SQL Server Linked Server.

Another option within SQL Server is the CLR, in which you can write code to retrieve data from web services or other data sources as needed.

While this may not technically be "SQL/MED", it seems to accomplish the same thing.

Distributed query using local table joined to 4-part linked server query. I think case the remotetable filter might not be applied until after the entire table is pulled local (documentation is fuzzy on this and I've found article with conflicting opinions):

SELECT * 
FROM LocalDB.dbo.table t
INNER JOIN LinkedServer1.RemoteDB.dbo.remotetable r on t.val = r.val
WHERE r.val < 1000
;

Using OpenQuery, remotetable filter is applied on the remote server, as long as the filter is passed into the OpenQuery 2nd parameter:

SELECT * 
FROM LocalDB.dbo.table t
INNER JOIN OPENQUERY(LinkedServer1, 'SELECT * FROM RemoteDB.dbo.remotetable r WHERE r.val < 1000') r on t.val = r.val
like image 44
BateTech Avatar answered Oct 25 '22 03:10

BateTech