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 1hsujE-0003uZ-49 for pgsql-general@arkaria.postgresql.org; Wed, 31 Jul 2019 19:57:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hsujC-0002WT-Kc for pgsql-general@arkaria.postgresql.org; Wed, 31 Jul 2019 19:57:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsujC-0002Qq-6n for pgsql-general@lists.postgresql.org; Wed, 31 Jul 2019 19:57:38 +0000 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hsuj9-000734-Q7 for pgsql-general@postgresql.org; Wed, 31 Jul 2019 19:57:37 +0000 Received: by mail-ot1-x331.google.com with SMTP id s20so6016589otp.4 for ; Wed, 31 Jul 2019 12:57:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lucee.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=hEiG1ioHgHxAQUaQ7nTmiS+WRzVQ6g/YoG0MVdhcykY=; b=YXPff84aJoSfQIUpOwN5uPDWuvsaAvFsaB5gOQf6BK8nCkUA08YLlXhHEvHYc9S6PI bCmFRn0i/bCLmaIJyF8HS71wRa1vkx+ERkt/VC7D5S2uMCSnbOb5v4Fdqs5+kozm9qIR ZdKf3zeiRzC7xjxqmv4uAB0QIYTJVkGNy3Yk9Tn6QO/boXWUj9w/WqcnjRzuES+0nl0b 0LtBVgX2reX9hqIa2q1CpUXACFjow7GD41cQNTY8VimsLFdHNCPQPTNDPL7VI8iOJUdV r16Zm/R+P0fVkEWvKxITYYmna+IqQsB0V2lFAxh3WeTmN74sozs0/ugL8cnA5VdgFM/D 6NJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=hEiG1ioHgHxAQUaQ7nTmiS+WRzVQ6g/YoG0MVdhcykY=; b=QLO4D53thYKzhNXEdudNESHrQiVbK5WIctUwWG0wCQv11AuLfYPkjW01JXfpUNn902 gos17nwgqYDCCHIBfNW8nh+HEzK+yK5LpWE52OyjIlnesVKmXxooKVpzqQQnZg6L7K3n gDt9TOWyLKd9kdLMZ4DjWxsn4A/hLEUkmiEiRroeWxQJmDiB1bP1DNI8s8HamueNCtu9 CsmiyezLVJ5ZR2JVTF+KG3EsQMgBbuW9Onb/nZVdqVhXN7l+3l0je/3G4R8mnsxeuDhr MDqopBJDMLjho+CC83X9NutkyDC43E+BrT/zAijW97BhGVVC9JRKtIrNAEYL1IOn1hjT SzYw== X-Gm-Message-State: APjAAAWIuZAbOFhOHhFN2SbMemtcs73zzEFhX7P4q4HlNkDxbj8Iflay WLy5S8Pau8Y7DTUVZZj0jpsVEgyR/vU= X-Google-Smtp-Source: APXvYqx/xDQisXkNEdhRSektK/jigs+oQt4bd/VgP0o7kO7i+yniNzZMkFJMoGVq/sYMnbvoFEW7Sw== X-Received: by 2002:a9d:63c7:: with SMTP id e7mr93775220otl.165.1564603053848; Wed, 31 Jul 2019 12:57:33 -0700 (PDT) Received: from ?IPv6:2600:1700:4000:8120:796c:3217:5784:98f0? ([2600:1700:4000:8120:796c:3217:5784:98f0]) by smtp.googlemail.com with ESMTPSA id 98sm25017722oti.18.2019.07.31.12.57.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jul 2019 12:57:33 -0700 (PDT) Subject: Re: DDL and DML in a transaction To: "David G. Johnston" Cc: pgsql-general References: <28ca745e-f459-95bd-bf80-7d907b65b9cf@lucee.org> From: "Igal @ Lucee.org" Message-ID: <4c485a6f-9845-8d45-d902-b6d24f59856b@lucee.org> Date: Wed, 31 Jul 2019 12:57:32 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------49DC396604987B5892B9D9A3" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------49DC396604987B5892B9D9A3 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Thank you, David. I should get more sleep... Igal On 7/31/2019 11:52 AM, David G. Johnston wrote: > On Wed, Jul 31, 2019 at 11:38 AM Igal @ Lucee.org > wrote: > >      alter table some_table >          rename column amount_num to amount_text; > >      alter table some_table >          drop column amount_num; > > > You just renamed amount_num to amount_text so I'm not sure why you > expect the drop to succeed. > > Would it have less locking than simply altering the column? > > > I doubt anything will improve upon simply altering the column.  You > have to perform a full table rewrite in either case which is going to > be the main resource consumer. > > David J. --------------49DC396604987B5892B9D9A3 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Thank you, David.

I should get more sleep...

Igal

On 7/31/2019 11:52 AM, David G. Johnston wrote:

On Wed, Jul 31, 2019 at 11:38 AM Igal @ Lucee.org <igal@lucee.org> wrote:
     alter table some_table
         rename column amount_num to amount_text;

     alter table some_table
         drop column amount_num;

You just renamed amount_num to amount_text so I'm not sure why you expect the drop to succeed.

Would it have less locking than simply altering the column?

I doubt anything will improve upon simply altering the column.  You have to perform a full table rewrite in either case which is going to be the main resource consumer.

David J.
--------------49DC396604987B5892B9D9A3--