Mp0int
Mp0int

Reputation: 18727

Alter table on a running database

I am using Postgres 8.4

I need to execute an ALTER statement on a running database with ~4M data on the relevant table. My sql is like:

ALTER TABLE some_table ALTER a_row bigint;

Now, relevant row type is int

But what i wonder is data consistency, Nearly 3-4 records are written to that table and some more are being read per second.

What i need to do for avoiding data consistency and such other problems.

Upvotes: 1

Views: 248

Answers (1)

Emir Akaydın
Emir Akaydın

Reputation: 5823

When you execute and ALTER TABLE sql, table will be locked and you shouldn't have any problems except some possible performance issues in INSERT sqls in your case. But if you are going to do this once, there is no reason to hesitate.

Upvotes: 1

Related Questions