Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wNZjY-000um8-20 for pgsql-admin@arkaria.postgresql.org; Thu, 14 May 2026 17:20:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wNZjX-00ECpu-1B for pgsql-admin@arkaria.postgresql.org; Thu, 14 May 2026 17:20:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wNZjW-00ECpm-2v for pgsql-admin@lists.postgresql.org; Thu, 14 May 2026 17:20:27 +0000 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wNZjV-00000000ZeD-19Ht for pgsql-admin@lists.postgresql.org; Thu, 14 May 2026 17:20:26 +0000 Received: by mail-ot1-x32c.google.com with SMTP id 46e09a7af769-7dcdaf06498so5480514a34.2 for ; Thu, 14 May 2026 10:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778779224; cv=none; d=google.com; s=arc-20240605; b=NWZIx66WkI2P1XdF8MjaDiWQBlioZyYeaTFrKspTzZef8pFKOkHbsUCSrQULkGA72n niMIqQJxlxYCQsLwiSfgOCanpObUUjiPoxRjwWyQN3lrTsYz+AdIxhc3uZAVP/dLR4ye JGkpaFAembokzZclJdTH7cRpXePiASAiSiDFIPGnEY1hSCWd/xCchj4iE1riQ/dW351D J5Wq9dyLRXL25/Qfo+AvllDcDOZqaky5yT7730vH2XhScCC7kDXM7CCVx3KefY9GCBUm 55QLzSDuUszpYEkWrxunCORlt0xXwNO2HiMTrrpM9E3eJMQZYV2QZa8Iude3W7A8e12v V2Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2TZESkEM/ZLI+D47JvZSlZftx9uMURNJAqaFPFLOXws=; fh=druxZHa2fk4e6MLibibygn9AWWgeaAPo4m8Gpo2MBXU=; b=RjhpmWlvQiU3RihddAdKPto+I8tp3GPiPbFrHfMFGCiOPOmRlqIC/VKcbU4U3Xv8Dh f4GxJM4fqu/EVq455TLxEqC/OuevQwT1xlv6olJi9lTlR6b3dynMVAnm3QcVP+4gjYX1 Q7SreMSKr4QIi2cLwd9wZG3e/en6JAtKwUB49FehCR2fRqxEwHmaYdnX6+KszzkaiW2s FziKsuFfPi+JaCQUZud7gB8iZvMJdavMPj4ryuFEUTnQcNTP4P56rILGDfHE370H/SP3 VaR0nWHAC9lz7n6Z/p+MkOzGh7H+7BulhCNG606OUvjKtk3n5gvZfTF2PxnVaiQBPGJm dPeA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778779224; x=1779384024; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=2TZESkEM/ZLI+D47JvZSlZftx9uMURNJAqaFPFLOXws=; b=j6mm5b6ASfcqGcXCCDRYvYE6yRL1Wt82KscovQc3HWwF2q+ilCZ7bvPBaCsrB3jGiQ pRVTCviE16ZYQYrfYTv0hGHW2C+5M2GoUuaLYri6rUQ9a+xvvLlgMOWzCyc1qJzUn0Z1 E4RU/Vj6tnIZ44v4QrBji+8ZRwDGMYfp5Yocj7zAYZdZRQn2dgx7O3Ra8H6gMq2IMRts kRNv4QO0aUoalw94kCO/VMeaN78hgBmNg8ZNXdTJbk/g0ZF9gc07cDHah3zafuJAeQet 09S+ZK8r8cXiGTiwSY3hzX173bZlLNRt4ql8PzoebspSHGry8ttWZI6Ylif4oTh4pIOc 6EJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778779224; x=1779384024; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2TZESkEM/ZLI+D47JvZSlZftx9uMURNJAqaFPFLOXws=; b=AcUUrnikGZwE/+Vmk53ceVtgssRJKFYtC+jghONu6jNJVEwd+OujYj8n7xUNcMKjv4 wYNwJh9NTYKJzlrHgj3qdtgmbreYb6EaJWgAAoyqnBNkerkGN7KNlFHrtqYfMmX/I52S 8cZJzjYqjb+5x1vqEwmTqkInLrZhvkXfbPG5Ot8X0H0Dq+AXrmFZggEQaElEC3flPgs9 Ey733bKOvt2qxEz4TVfLRv0NscfvQjoJKZbDx6T2nM3ymHBkkgu6qM+kA+1HH18epfYG REBKHvARCewbrvX89VPhvj4TuBcz8BfCNgC6CCaBhKsEGgWngCtpxcCHT3V2RZbL/yWT EDIQ== X-Gm-Message-State: AOJu0YzAUiA1oxN77Tb+4uRdaaJWPH9Xnx3FQrj+xTXbhEELBaeZIJOY L8arAkgtJ4fZNuhHfSWgP372+qakBitdaNwbygSNq4trnAGyT7p24ya6S7Q8lDLEaJFahSQHQzw plOYgvT/4tmEpYF3DhP00mbw5ciP3d7mj5g== X-Gm-Gg: Acq92OEygBEXnjZ1ud8Bq05b5zGtkqA4OQ86XTCD3jxH390GQhdOdEiIHwNhIpuooAK AVhpTUBycx0OtVdfZV08TODZ0ldCQyLfH3HM09gPaUqiDUx6HHsPFWWbhDMesma59y9EGdpCfgq bL2rM35nP6mL4EHFAzsRDA0AG+4R6/X/zMFuIaX0DTHTVC4nKb+uWdkPhENI2GiKIOQNAE7dKiy XzpV2XWywfcMwlM7tgRUKY9Gt6EltmVog1T0wnkbr29HwN+UMl/7bLiMaKA1YvfhMwvz7roYBuE JU1V+lOvPxNy+AIrUnBBWIaZUuajnA== X-Received: by 2002:a05:6820:8188:b0:696:9364:c284 with SMTP id 006d021491bc7-69c9c02054emr194815eaf.44.1778779224089; Thu, 14 May 2026 10:20:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Thu, 14 May 2026 13:20:12 -0400 X-Gm-Features: AVHnY4JDQygPOLwU0ZGAeX7vKFiCPBVvSuwrkbxJPUE6AD77BE8sEHoS5MhAbYc Message-ID: Subject: Re: Alter the datatype on all tables present in the database (bigint to varchar) To: Pgsql-admin Content-Type: multipart/alternative; boundary="000000000000c92ae40651ca4f88" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c92ae40651ca4f88 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 14, 2026 at 11:07=E2=80=AFAM Gambhir Singh 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!!! --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000c92ae40651ca4f88 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, May 14, 2026 at 11:07=E2=80=AFAM = Gambhir Singh <gambhir.sing= h05@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. Ple= ase 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.
  • <= li>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.=C2=A0

With= tables that big, and all those FK constraints, logical replication is prob= ably your only hope for minimal downtime.

If you&#= 39;re running an older major version, this would also be a good time to upg= rade to 17.latest or 18.latest.

And Adrian's q= uestion is quite valid: why?=C2=A0 Normally, people go the other=C2= =A0way, for efficiency.
=C2=A0
  • Physical Replication is = configured with 2 standby DBs.=C2=A0=C2=A0
At least you have an existing server with enough disk space!!!
=



--
Death to <Redacted>, and butter sauce.
Don't bo= il me, I'm still alive.
<Redacted> lobster!
--000000000000c92ae40651ca4f88--