public inbox for pgsql-general@postgresql.org
help / color / mirror / Atom feedFrom: Ron Johnson <ronljohnsonjr@gmail.com>
To: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Alter the datatype on all tables present in the database (bigint to varchar)
Date: Thu, 14 May 2026 13:20:12 -0400
Message-ID: <CANzqJaBiSXdTSzYS18fc_XUHKUHPkhBu-uz2cW691BLSHnbydw@mail.gmail.com> (raw)
In-Reply-To: <CAHOGQfVo0FWX8mS9FLTmpDOb5XC5-T4qx4ouhw0wOfNeLdahsA@mail.gmail.com>
References: <CAHOGQfVo0FWX8mS9FLTmpDOb5XC5-T4qx4ouhw0wOfNeLdahsA@mail.gmail.com>
On Thu, May 14, 2026 at 11:07 AM Gambhir Singh <gambhir.singh05@gmail.com>
wrote:
> Hi,
>
> Please help me with the best way to change the datatype of a column in a
> all tables in DB from bigint to varchar. Please consider the following
> facts.
>
>
> - DB Size - 75 TB
> - Number of tables - ~100
> - Some tables are partitioned and some are not partitioned.
> - All partitioned tables are big in size.
> - For reference, the largest partition size is 4 TB, similarly the
> size of 10-12 partitions ranges between 1 to 4 TB.
> - We have indexes and FK on tables.
>
>
With tables that big, and all those FK constraints, logical replication is
probably your only hope for minimal downtime.
If you're running an older major version, this would also be a good time to
upgrade to 17.latest or 18.latest.
And Adrian's question is quite valid: *why*? Normally, people go the
other way, for efficiency.
>
> - Physical Replication is configured with 2 standby DBs.
>
> At least you have an existing server with enough disk space!!!
--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
reply
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 using the --to and --cc options:
reply via email
To: pgsql-general@postgresql.org
Cc: ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: Alter the datatype on all tables present in the database (bigint to varchar)
In-Reply-To: <CANzqJaBiSXdTSzYS18fc_XUHKUHPkhBu-uz2cW691BLSHnbydw@mail.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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox