From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Alter the column data type of the large data volume table.
Date: Thu, 3 Dec 2020 12:16:25 -0600
Message-ID: <ece5a674-1af9-0e4b-1dcc-41f0b3d92d53@gmail.com> (raw)
In-Reply-To: <CAHOFxGpLaVtFEbyQ0t-HZQ-dWh3WTqsX89Xubp1wm7CNGO0JLQ@mail.gmail.com>
References: <CAD5cqMJT9Q=U3EkpgjsL5QcHNXfwvHVHe+RBabZBXh4OW9n8AA@mail.gmail.com>
<CAHOFxGpqi_=T2JQf+eNef3A5XR-Z9FeSB-hpZkG5aOr0PPvi0g@mail.gmail.com>
<alpine.LNX.2.20.2012030915280.29996@salmo.appl-ecosys.com>
<CAHOFxGpLaVtFEbyQ0t-HZQ-dWh3WTqsX89Xubp1wm7CNGO0JLQ@mail.gmail.com>
On 12/3/20 11:53 AM, Michael Lewis wrote:
>
>
> On Thu, Dec 3, 2020 at 10:18 AM Rich Shepard <rshepard@appl-ecosys.com
> <mailto:rshepard@appl-ecosys.com>> wrote:
>
> Tell me, please, why
>
> ALTER TABLE <tablename> ALTER COLUMN <columnname> SET DATA TYPE BIGINT
>
> will not do the job?
>
> I've found some varchar columns in a couple of tables too small and
> used the
> above to increase their size. Worked perfectly.
>
>
>
> Something else noteworthy is that with varchar, there is no rewrite of the
> table. You are just removing or loosening the length restriction on a
> variable width column type. I believe you could change all columns from
> VARCHAR(n) to TEXT or VARCHAR(n+X) and have it take almost no time at all
> since you are only impacting the catalog tables (pretty sure about that at
> least). With a fixed width column like int4 to int8, all the rows need to
> be actually re-written.
And in this case it's the PK, so indexed and thus even slower. Lots slowe.
--
Angular momentum makes the world go 'round.
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: ronljohnsonjr@gmail.com
Subject: Re: Alter the column data type of the large data volume table.
In-Reply-To: <ece5a674-1af9-0e4b-1dcc-41f0b3d92d53@gmail.com>
References: <CAD5cqMJT9Q=U3EkpgjsL5QcHNXfwvHVHe+RBabZBXh4OW9n8AA@mail.gmail.com> <CAHOFxGpqi_=T2JQf+eNef3A5XR-Z9FeSB-hpZkG5aOr0PPvi0g@mail.gmail.com> <alpine.LNX.2.20.2012030915280.29996@salmo.appl-ecosys.com> <CAHOFxGpLaVtFEbyQ0t-HZQ-dWh3WTqsX89Xubp1wm7CNGO0JLQ@mail.gmail.com> <ece5a674-1af9-0e4b-1dcc-41f0b3d92d53@gmail.com>
* 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