Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyEmH-0004cc-HP for pgsql-general@arkaria.postgresql.org; Wed, 22 Jul 2020 13:27:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jyEmF-0006XO-Tw for pgsql-general@arkaria.postgresql.org; Wed, 22 Jul 2020 13:27:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyEmF-0006XH-LZ for pgsql-general@lists.postgresql.org; Wed, 22 Jul 2020 13:27:19 +0000 Received: from mail.verite.pro ([185.16.44.216]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jyEmC-0004CD-Fm for pgsql-general@postgresql.org; Wed, 22 Jul 2020 13:27:19 +0000 Received: from genius-map.net (verite.pro [195.154.189.246]) by mail.verite.pro (Postfix) with ESMTP id 789D68C0229; Wed, 22 Jul 2020 15:18:14 +0200 (CEST) Received: by genius-map.net (Postfix, from userid 1001) id 4BBE438A0754; Wed, 22 Jul 2020 15:27:13 +0200 (CEST) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: Switching Primary Keys to BigInt From: "Daniel Verite" To: "Mohamed Wael Khobalatte" Cc: "Michael Lewis" ,"pgsql-general" In-Reply-To: Date: Wed, 22 Jul 2020 15:27:08 +0200 Message-Id: <029f54d9-99ec-49d2-b8eb-567bf6b4f3ce@manitou-mail.org> X-Mailer: Manitou v1.7.3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Mohamed Wael Khobalatte wrote: > > alter table change_seq alter COLUMN id set data > > type bigint; > This is significant downtime, since it locks exclusively, no? We want to > avoid that. Well, in the steps you mentioned upthread, the transaction starts by doing LOCK TABLE some_table, so it will hold an exclusive lock on it for the rest of the transaction. If you can test how the ALTER TABLE... SET TYPE ... compares to your procedure in terms of downtime, that would be interesting. To me, it's not clear why the procedure in multiple steps would be better overall than a single ALTER TABLE. Best regards, --=20 Daniel V=E9rit=E9 PostgreSQL-powered mailer: https://www.manitou-mail.org Twitter: @DanielVerite