Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6Ln5-00046D-2I for pgsql-admin@arkaria.postgresql.org; Tue, 19 Mar 2019 20:56:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h6Ln3-0003Af-R0 for pgsql-admin@arkaria.postgresql.org; Tue, 19 Mar 2019 20:56:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6Ln3-00032L-E6 for pgsql-admin@lists.postgresql.org; Tue, 19 Mar 2019 20:56:53 +0000 Received: from allegro-1.evaristesys.com ([209.51.167.66] helo=evaristesys.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6Ln0-0007Lo-GP for pgsql-admin@lists.postgresql.org; Tue, 19 Mar 2019 20:56:51 +0000 Received: from 107.sub-174-223-134.myvzw.com ([174.223.134.107] helo=typhoon) by evaristesys.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1h6Lmy-0006Ma-Ad for pgsql-admin@lists.postgresql.org; Tue, 19 Mar 2019 16:56:48 -0400 Date: Tue, 19 Mar 2019 16:52:51 -0400 From: Alex Balashov To: pgsql-admin@lists.postgresql.org Subject: Re: Adding Column on Huge Table Message-ID: <20190319205251.GC2983@typhoon> References: <5b26ed21-a7b5-6c1b-af10-10df4d44a4f7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5b26ed21-a7b5-6c1b-af10-10df4d44a4f7@gmail.com> Organization: Evariste Systems User-Agent: Mutt/1.11.4 (2019-03-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk My experience is that adding a column is a rather quick operation even on quite large tables, _unless_ the column has a default value, in which case that default value is set for every row. In that case, the time required for the operation converges with that of a mass-UPDATE. On Tue, Mar 19, 2019 at 09:53:16PM +0100, Andrzej Zawadzki wrote: > On 19.03.2019 16:56, Moin Akther wrote: > > Dear Experts, > > We want to add a column on table size of 1.5TB, we have to perform this > activity with minimal downtime.  > > What are the best practises to add a column on huge table ? > > How much time alter statement will take to add column ? > > Any alternate solution other than alter statement to add column ? > > Will adding a new column on a huge table generate huge WAL files ? > > > No offense, but don't you have any test environment? > > Try that or maybe you have so show times. > > > -- > > Andrzej Zawadzki > -- Alex Balashov | Principal | Evariste Systems LLC Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/