Giter Club home page Giter Club logo

mysql2pgsql's Introduction

mysql2pgsql

Tool for migrating a full database from mysql to postgresql

#Build

mvn clean install 

#Prerequisites mysqldump and psql needs to be installed and on the path for the process

#Run

java -Xmx4G -jar target/mysql2pgsql-1.0-SNAPSHOT.jar mysqlhost mysqlport mysqluser mysqlschema pgsqlhost pgsqlport pgsqldb pgsqluser pgsqlschema [table1...tableN]

Where the only optional argument is the list of tables. If provided, only those tables will be migrated. The memory requirement is because of migration taking place in parallell threads, where each thread will shuffle quite large data sets.

#Flow of operation

  1. Dump mysql schema using mysqldump
  2. Convert schema to pgsql format
  3. Create schema and tables in pgsql with converted schema file. No indexes or constraints applied in this phase
  4. Migrate all data from mysql to pgsql using jdbc, splitting tables into multiple batches if they are large
  5. Create primary keys
  6. Create indexes and other constraints
  7. Update all sequences to the current max value of each serial column

#Not converted by this tool

  • Views
  • Functions
  • Users/Accounts
  • Table partitioning

#Misc Initial attempt was made with bash and python, using mysqldump to transport all data. This solution was quite slow, and when tested, jdbc and batching inserts turned out to be four times faster. The data types converted by this utility so far is based on a real life mysql instance: there is probably quite a few types that are missing. To be improved.

mysql2pgsql's People

Watchers

janeluo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.