Speed of conversion from int to bigint

From: Jonathan Moules <jonathan-lists(at)lightpear(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Speed of conversion from int to bigint
Date: 2017-09-27 08:08:25
Message-ID: 15ec2604a7d.e9912c3985278.6402582227177025587@lightpear.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
(Postgres 9.5 and 9.6)
We have a table of about 650million rows. It's a partitioned table, with two "child" tables. We want to change its primary key type from int to bigint while retaining the current values.

We're using this:

ALTER TABLE dta.my_table ALTER column table_id TYPE bigint;

But it's taking a very long time, and locking the database. We're going to need to do this in production as well, so a long-term table-lock isn't workable.
Is there anything we can do to speed things up? How long is this likely to take?

Thanks,
Jonathan

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Güttler 2017-09-27 08:12:17 Re: Final pg_dumpall should happen in Single-User-Mode
Previous Message Thomas Güttler 2017-09-26 10:18:34 Re: VM-Ware Backup of VM safe?: snapshots: quiesced and non-quiesced