Re: Change from BIGINT to INT in prod.

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Walters Che Ndoh <chendohw(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Change from BIGINT to INT in prod.
Date: 2020-11-06 08:27:22
Message-ID: eba1e522e6a0cf69b6bca6c36e45f6d101670c84.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, 2020-11-05 at 11:23 -0700, David G. Johnston wrote:
> > So when i try running alter table table_name alter column column_name type INT; , it is hanging and starts providing a lock on the table.

It has to rewrite the table and needs an AccessExclusive lock.
You have to suspend all concurrent activity on that table.

> I'm not seeing the point of doing this specific conversion at all really

Exactly; this exercise is not necessary.
The few bytes you are saving are not worth the trouble.

Yours,
Laurenz Albe
--
+43-670-6056265
CYBERTEC PostgreSQL International GmbH
Gröhrmühlgasse 26, A-2700 Wiener Neustadt
Web: https://www.cybertec-postgresql.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Holger Jakobs 2020-11-06 08:49:49 Re: Remote Access Help
Previous Message DaStormer 2020-11-06 00:13:22 Remote Access Help