Move Over To PostgreSQL With Babelfish and MangoDB
Written by Nikos Vaggalis   
Tuesday, 16 November 2021

Babelfish and MangoDB are two solutions that move your application workloads from SQL Server and MonoDB respectively to PostgreSQL.

We have repeatedly outlined why PostgreSQL rules the DBMS world. Some examples are PostgreSQL 14 Is Here - A Look At Its Past And Future and PostgreSQL Is DB-Engines DBMS of the Year For 2020.

While there are existing methods for moving from DBMS "A" to Postgres, as The Complete Oracle to PostgreSQL Migration Guide by EDB demonstrates, migrating application code is a whole different concept.To meet this need Babelfish and MangoDB let PostgreSQL understand queries from applications written for Microsoft SQL Server and MongoDB respectively.

Specifically:

Babelfish is a set of extensions that provide both T-SQL capabilities and a Tabular Data Stream (TDS) listener port as enhancements to PostgreSQL. It supports the SQL Server dialect, T-SQL, and notable features including savepoints, stored procedures, nested transactions, etch.

while MangoDB

is a stateless proxy, which converts MongoDB protocol queries to SQL, using PostgreSQL as a database engine. It is compatible with MongoDB drivers, and should work as a drop-in replacement to MongoDB in many cases.

So what are their benefits?

To start with, getting rid of licensing fees, since you move from propriety SQL Server to open source PostgreSQL. But what about MongoDB, isn't it open source already? Yes, but it has recently changed its license to SSPL (check The SSPL is Not an Open Source License) making it unusable for many Open Source and Commercial Projects.

With this approach you can port your application originally built for SQL Server and MangoDB to work with a Postgres backend engine. For instance, Babelfish has its own parser that creates the appropriate query nodes, so that the SQL Server dialect can be executed by PostgreSQL natively. Babelfish also supports T-SQL semantics, plus it uses the same network protocol, port, and connectivity drivers of SQL Server which by default runs on port 1433.

Babelfish comes as a patch against community PostgreSQL, and a bunch of extensions built on top of the patch: 

  • babelfishpg_tsql: supports the T-SQL language
  • babelfishpg_tds: supports the TDS wire protocol
  • babelfishpg_common: supports new datatypes found in T-SQL
  • babelfishpg_money: supports the money type in SQL Server

As for MangoDB, it acts as an open-source proxy which converts MongoDB wire protocol queries to SQL, and uses PostgreSQL as the database engine, hence acting as a drop-in replacement for MongoDB in many cases. This way, MongoDB drivers and even tools can be used with an application which would otherwise rely on MongoDB, while still benefiting from the ease and flexibility of a document database, especially given Postgres' strong JSON capabilities.

As already said, both Babelfish and MangoDB are Open Source software under the terms of the Apache 2. 0 license. As such both projects are hosted on Github as well.

 

More Information

Goodbye Microsoft SQL Server, Hello Babelfish

MangoDB-A truly Open Source MongoDB alternative

BabelFish on GitHub

MangoDB on GitHub

Related Articles

PostgreSQL 14 Is Here - A Look At Its Past And Future 

PostgreSQL Is DB-Engines DBMS of the Year For 2020

SQL Server on Linux, Love or Calculated Move?

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Google Releases Gemma Open Models
28/02/2024

Google has released a set of lightweight open models that have been built from the same research and technology used to create Google's recent Gemini models.



100 Episodes of 5mins of Postgres
08/03/2024

The popular PostgreSQL explainer series is celebrating its 100th release and beyond. Let's take a look at what it makes it so special.


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Tuesday, 16 November 2021 )