How to migrate data from mySQL to PostgreSQL?

How does PostgreSQL and Oracle react to alter table command, compared to MySQL?

  • Context: I am working with MySQL and i know when you run an alter command on MySQL. It internally delete the table and creates a new table by locking the table. http://dev.mysql.com/doc/refman/5.0/en/alter-table.html Now: At work we have started using PostgreSQL and Oracle. We are going to add columns at run-time (based on some internal requirement).  I wanted to know does all database behave the same. Meaning do they internally restructure by deleting the old meta-data and then creating the new table. Especially PostgreSQL and Oracle.

  • Answer:

    Alter table to create column in PostgreSQL will not lock a big table. It will take some milliseconds even in some gigabytes tables.  Strange is the fact if the new column does have a DEFAULT clause it will take a very long time locking the table instead. If you are creating some index, give a look to the Create index concurrently and drop index concurrently commands. About Oracle I don't know about.

Vinícius Corrêa at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.