From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeremy Finzel <finzelj@gmail.com>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Cases where alter table set type varchar(longer length) still needs table rewrite
Date: Mon, 17 Feb 2020 09:21:12 -0500
Message-ID: <573.1581949272@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMa1XUiqdpJZHq_bDAsvbEZw=RjtOuH3z1xz-Xd27a6b1Pf9xA@mail.gmail.com>
References: <CAMa1XUiqdpJZHq_bDAsvbEZw=RjtOuH3z1xz-Xd27a6b1Pf9xA@mail.gmail.com>
Jeremy Finzel <finzelj@gmail.com> writes:
> I have a table foo with 100 million rows, and a column:
> - id character varying(20)
> The following command is the one that we expect to execute very quickly (we
> are not seeing any locking), but it is instead taking a very long time:
> - ALTER TABLE foo ALTER COLUMN id TYPE varchar(100);
Hm, the code is supposed to avoid a table rewrite, but I wonder if
there's something else that's not being avoided, such as an index
rebuild or foreign-key verification. Could we see the whole table
definition, eg from psql \d+ ?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, finzelj@gmail.com
Subject: Re: Cases where alter table set type varchar(longer length) still needs table rewrite
In-Reply-To: <573.1581949272@sss.pgh.pa.us>
References: <CAMa1XUiqdpJZHq_bDAsvbEZw=RjtOuH3z1xz-Xd27a6b1Pf9xA@mail.gmail.com> <573.1581949272@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox