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.94.2) (envelope-from ) id 1sehBa-00AoSo-8C for pgsql-general@arkaria.postgresql.org; Thu, 15 Aug 2024 20:35:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sehBX-0015lx-Uc for pgsql-general@arkaria.postgresql.org; Thu, 15 Aug 2024 20:35:03 +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.94.2) (envelope-from ) id 1sehBX-0015lm-JO for pgsql-general@lists.postgresql.org; Thu, 15 Aug 2024 20:35:03 +0000 Received: from mail-yw1-x1135.google.com ([2607:f8b0:4864:20::1135]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sehBV-004ui0-8B for pgsql-general@lists.postgresql.org; Thu, 15 Aug 2024 20:35:02 +0000 Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-683f688ef85so1852037b3.3 for ; Thu, 15 Aug 2024 13:35:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723754100; x=1724358900; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ztvsASIMJGbGeFP2E0b5QJrNrpZvlzEi4RcYmBJhzvg=; b=UTfgMmRTyCUdJAHcGWe9X/BZe9joukWZdsY096PFt6+/LX08szjPXY4nBsEaP7b/SC xEtzHdR4kyoj8shMvRh5IOBYgijPdkdeTPPJQw4liqvGmwb/vMPp+/P4ZQq1bCrWkLrw cdeIqOCnSG4z00ZLmFdrpnZ0j3a4Ki/n1rMY+Nwh2nHv3gjjCZoz0l2kNmhql2qfygd4 hQqq+vnkT/LVVaHqnQbYsgBos8NPl0udgkoyr3/cqYQDMRK2K5k/7PAlx2eQ4UeUqCws R7SnEKNVT6hHlE3NdJLsNMZMOXpLizbiETuaHRUvR9pXnUJ2pWE57qS2iQkKgzELva2E ksKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723754100; x=1724358900; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ztvsASIMJGbGeFP2E0b5QJrNrpZvlzEi4RcYmBJhzvg=; b=tMlZkOKi3cdekDQFl50ZI1z3jHhrKDETkNJpi/IFZZnnI1UFIuqRWMi5kRktEAQCaN XDEpWXQE9fjSri+56OwRT02IKR5fDYXrGxMFIBPNdTvnn0sC+WEgNgfs65SUwlSvLRF1 FvQzPdlOyeLdfPBL/slMmGUs5vZ76TB+14GHhFtDrEGwvf72oERwpk757g+BCmDqgWXd KRkpeML3YurDOjs94368uoErM2us/+gdwCy5K0pmhNj7hhvQBABtyWPSSuQ4zaP4+B94 n6lmFMGDGOmJu0GDDCiWrfaSTDqpCgmPjB61L8Opj30wUDUvDuGY6NjXvoy/AjbWQ2yE hUjw== X-Forwarded-Encrypted: i=1; AJvYcCXfEvUwEKXraMuko+x+bsebjZddU5Nl55lpzDO3TOg3ICWPOJCLU2zS/fpHzIPBOTgU9OYo/3MpTMbnxKug2V307o4H0HBZ8j1pCZ7J6vny7IPI X-Gm-Message-State: AOJu0YxNO48oBXd5s1g/Rt6Y/bYYCuZvsbySMQ/akpvK9HrABiJWdU/W y4Mgci0AqNLUJeZ4L4DfdOD12OzrYbB4CXO0xVPVUdHLuaym30LkSpefNHng7bAUdzoQRyPOUT2 qCoywOsS5oPLqK9IjedGVE0EngU0= X-Google-Smtp-Source: AGHT+IFrlMHCZLe/zTbXinWWqv6WtHbjp+cB0YQ14kns9EslzAADeGiSy3/8/jePmPQJ16sy3OhH7+tKCj/gVl19e+o= X-Received: by 2002:a05:690c:fc7:b0:64b:95ef:d098 with SMTP id 00721157ae682-6b1b241cde4mr5523127b3.0.1723754099950; Thu, 15 Aug 2024 13:34:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Lok P Date: Fri, 16 Aug 2024 02:04:47 +0530 Message-ID: Subject: Re: Column type modification in big tables To: Alban Hertroys Cc: Greg Sabino Mullane , sud , pgsql-general Content-Type: multipart/alternative; boundary="000000000000cecffd061fbec67f" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000cecffd061fbec67f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Aug 15, 2024 at 9:18=E2=80=AFPM Alban Hertroys = wrote: > > > On 15 Aug 2024, at 14:15, Lok P wrote: > > (=E2=80=A6) > Are all those partitions critical, or only a relative few? > > If that=E2=80=99s the case, you could: > 1) detach the non-critical partitions > 2) take the system down for maintenance > 3) update the critical partitions > 4) take the system up again > 5) update the non-critical partitions > 6) re-attach the non-critical partitions > > That could shave a significant amount of time off your down-time. I would > script the detach and re-attach processes first, to save some extra. > > Thank you so much. The partition table which we are planning to apply the ALTER script is a child table to another big partition table. And we have foreign key defined on table level but not partition to partition. So will detaching the partitions and then altering column of each detached partition and then re-attaching will revalidate the foreign key again? If that is the case then the re-attaching partition step might consume a lot of time. Is my understanding correct here? --000000000000cecffd061fbec67f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

On Thu, Aug 15, 2024 at 9:18=E2=80=AFPM A= lban Hertroys <haramrae@gmail.com<= /a>> wrote:
<= br> > On 15 Aug 2024, at 14:15, Lok P <loknath.73@gmail.com> wrote:

(=E2=80=A6)
Are all those partitions critical, or only a relative few?
If that=E2=80=99s the case, you could:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 1) detach the non-critical partitions
=C2=A0 =C2=A0 =C2=A0 =C2=A0 2) take the system down for maintenance
=C2=A0 =C2=A0 =C2=A0 =C2=A0 3) update the critical partitions
=C2=A0 =C2=A0 =C2=A0 =C2=A0 4) take the system up again
=C2=A0 =C2=A0 =C2=A0 =C2=A0 5) update the non-critical partitions
=C2=A0 =C2=A0 =C2=A0 =C2=A0 6) re-attach the non-critical partitions

That could shave a significant amount of time off your down-time. I would s= cript the detach and re-attach processes first, to save some extra.

=

Thank you so much.=C2=A0

The partition table which we are planning to apply the ALTER script= is a child table to another big partition table. And we have foreign=C2=A0= key defined=C2=A0on table level but not partition to partition. So will det= aching the partitions and then altering column of each detached partition a= nd then re-attaching will revalidate the foreign key again? If that is the = case then the re-attaching partition step might consume a lot of time. Is m= y understanding correct here?
--000000000000cecffd061fbec67f--