Friday 22 September 2017
  • :
  • :

How to Convert MySQL to PostgreSQL

When planning to convert MySQL to PostgreSQL, it is important to understand cons and pros of every DBMS as well as scope of database objects that have to be converted. Main advantage of MySQL against PostgreSQL is that it’s easy to install and to use. PostgreSQL has multiple advantages such as:full compliance with SQL standard, support for different indexing models, common table expressions, outer joins.

Database migration process involves migrating such objects as table definitions, data, indexes, constraints, views, stored procedures and triggers.

Basically, database conversion from MySQL to PostgreSQL includes the following stages:

  • Definitions of all tables, indexes and constraints (DDL) are extracted from MySQL database in form of SQL CREATE or ALTER statements
  • These DDL statements must be converted according to PostgreSQL format and loaded into the target database
  • Data of each MySQL tableis exported in comma separate values (CSV) files
  • Then every CSV file must be transformed in order to comply with the destination format and loaded into PostgreSQL database.
  • All of MySQL views, stored procedures and triggers are exportedas SQL statements and source code
  • These SQL statements and source code are converted into PostgreSQL format and imported into the target database

On large and complex databases manual conversion may require a lot of efforts and cause risk of data loss or corruption due to the human factor. That’s why database specialist who is in charge for converting MySQL to PostgreSQL may consider using special conversion tool.

The next question is what are the main features that advanced MySQL to PostgreSQL converter must provide. And here is the list:

  • the program must work with all versions of PostgreSQL including Herokuand all variations of MySQL including MariaDB and Percona
  • such database objects as table definitions, data and constraints must be processed in fully automated mode
  • command line arguments must be supported in order to schedule and script the conversion process
  • the program must provide options to merge MySQL data into existing PostgreSQL table and to synchronize destination table with it

MySQL-to-PostgreSQL database conversion tool developed by Intelligent Converters has all capabilities listed above. In addition, it provides Option to export MySQL database into SQL script file for those cases when there is no remote connection to PostgreSQL server available. Also, the program can filter data for conversion via SELECT-queries. Finally, MySQL to PostgreSQL converter provides option to modify name, type, default values for every column and exclude some of them from the conversion. This feature is known as columns mapping customization.

Synchronizationin the database migration tool is implementedasinserts of MySQL records missing in the destination table and updates of existing PostgreSQL records with the source data. Identical structures and equal primary keys or unique indexes of the source and destination tables are required.

MySQL to PostgreSQL converter comes with trial version that converts 50 records per table and does not convert foreign keys. As every product of Intelligent Converters, this one is supplied with unlimited 24/7 support and annual subscription for updates.

Find more details about MySQL to PostgreSQL migration tool at the official site:

Leave a Reply

Your email address will not be published. Required fields are marked *