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 1pZVzD-0008M2-6j for pgsql-admin@arkaria.postgresql.org; Tue, 07 Mar 2023 12:00:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pZVzC-0004hk-4C for pgsql-admin@arkaria.postgresql.org; Tue, 07 Mar 2023 12:00:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZVzB-0004hb-KA for pgsql-admin@lists.postgresql.org; Tue, 07 Mar 2023 12:00:05 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZVz8-00048p-05 for pgsql-admin@lists.postgresql.org; Tue, 07 Mar 2023 12:00:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cb2ts5C5JHZWcSHtefxsfczGeEbedlWghUrmnFAdLwg=; b=ewVcj87QRi2Y9QwOarPg3lLMBK /6aIj5lnW2/YL+I4YGzhuMZq+EbY8rzdjRJCrL5v9m6YXXVzAAZpAqEYYBr8exNIF6ycAa0X64A0a i6BjI09awdY7yqLIWTeGPJdxqdZO/8Pnx0NASGWENll1EN/xtRN2sR7QUgfh7zaNELHA=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1pZVz4-005yBD-6F; Tue, 07 Mar 2023 12:59:58 +0100 Date: Tue, 7 Mar 2023 12:59:58 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Joseph Hammerman Cc: pgsql-admin@lists.postgresql.org Subject: Re: Migrating tables to new schema with minimal downtime Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 06, 2023 at 01:00:15PM -0800, Joseph Hammerman wrote: > Would it be data safe if I took an ACCESS EXCLUSIVE lock on the table? alter table gets ACCESS EXCLUSIVE lock on its own. You can test it trivially in psql on some side table. Best regards, depesz