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
Related Q & A:
- How to convert Oracle script to MySQL script?Best solution by Stack Overflow
- How to know the Oracle Database Name?Best solution by Stack Overflow
- How to create a table in PHP with MySQL?Best solution by Stack Overflow
- How to change the color of the white table in default layout?Best solution by Yahoo! Answers
- How to change brightness on Linux desktop through the command line?Best solution by Super User
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.