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 1tVvNg-00Cg7f-PR for pgsql-general@arkaria.postgresql.org; Thu, 09 Jan 2025 16:27:37 +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 1tVvNg-0047Sc-Ah for pgsql-general@arkaria.postgresql.org; Thu, 09 Jan 2025 16:27:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tVvNf-0047PW-Vc for pgsql-general@lists.postgresql.org; Thu, 09 Jan 2025 16:27:35 +0000 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tVvNc-000lGP-2u for pgsql-general@lists.postgresql.org; Thu, 09 Jan 2025 16:27:35 +0000 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-29ff8053384so566578fac.3 for ; Thu, 09 Jan 2025 08:27:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736440051; x=1737044851; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=apXN3YyRumyWsdb+wD3hnh3J030IkJ0lziBFIPXLNFU=; b=iS+/cJLt0x4MFhZUZTbSbDWekMj5g4TJ8JETYDJyP72bgEIKYNOerTtrJBZGbW7zB5 FC6Bf3pU9CxIY7vqG6PMdj5Gs86hrE3zph4h+3S3LzkgrlxTAf0QB/phSBQp1FYirDoy Ovomj1gCGLDaof2n9cIJEGua+l11D/okJ/GjRLKYpSGAFiUBblcYPpfIAR3wqbSVXiK9 F5/ei/8enoa3OB7Squkb9Hs5nJ2t3PgeNftf079/64bJ1WquwAMXlBfZ4eK3bvwCPdzF 5uSMg2txSiI/x0zc6V2ha2aKOVKzshhKc0L50R7T/gehmNEMbVjguM8nJafIJyVfU3Sl RGFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736440051; x=1737044851; h=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=apXN3YyRumyWsdb+wD3hnh3J030IkJ0lziBFIPXLNFU=; b=gaJVQVbZDykqJY50pygWrx/c+ZzE1tFG9tUqHPRt1tEPVTpORERQol+vJv32CN8HKy hpO18jAwjGwIND//aD1jHMuxII+/MU0vbcLQhITIqoSoZOXqYIrnc+XclKQjGz4fn07o 1kqUEp2EOuO1W3M4uNKIMpWBq8Kez9ZV4iy9HZdrA0aVOFjebgEeHeSiRHgXUUT2Vc7D jsLxx4cFfEm4xn8Ufoc6Ho0qsjVr/37J4YF/I1ALkcTYe7Qsuy+DrlCg+TrhY8t2kKWU fnXZRD2KXggAU9mtAIunAPHFM00k1I0Oho3qSE8yTe/sffd6b7MlATlTmGs2w+RsIobo 69vg== X-Gm-Message-State: AOJu0YxRx+Shvskww7E7/p9VFXc+PX0M5qMbMhUCUxJA4YjDAFHJGbhT +ALJ2M3OHjIZjI83HJ08kgikmUDNqJaDJAoCzenK1GJZGY4di5tKITm7F6oyUrJBaGqtcBqq35U nyhQ3okFbFWy7hKtuudNC2YwavIpV2A== X-Gm-Gg: ASbGnctk4ij0Y4lZDGspI8KCIrbxxJvvY7Guw63uOfD4VjXajMo8Eulg218hpIAJGM3 IFdK8Az9Sjm5eQJe8fsVot60LTIyLSJWYbHwsOVz8i+nwjyYEHoodhmJdOwRlBwV7FZI/meas X-Google-Smtp-Source: AGHT+IGjtxEpHZMMM2DZhDN0BqBqeCV6MhY2vwXJskkaKFE0Cxq5wBeBO5tJV6VnrJYFkLy4sjrXQMYc8Gw5XAI418I= X-Received: by 2002:a05:6871:d30a:b0:295:ed0a:8061 with SMTP id 586e51a60fabf-2aa0699a736mr3496582fac.39.1736440051592; Thu, 09 Jan 2025 08:27:31 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Ron Johnson Date: Thu, 9 Jan 2025 11:27:20 -0500 X-Gm-Features: AbW1kvaHYirOqKYpPQsD8HKd1o9a7sBtYHHl-vG08QRRzZAPK029nGZadonpI20 Message-ID: Subject: Re: Alter table fast To: pgsql-general Content-Type: multipart/alternative; boundary="00000000000072f68a062b4874af" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000072f68a062b4874af Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 9, 2025 at 11:25=E2=80=AFAM veem v wrote: > Hello, > It's postgres version 16.1, we want to convert an existing column data > type from integer to numeric and it's taking a long time. The size of the > table is ~50GB and the table has ~150million rows in it and it's not > partitioned. We tried running the direct alter and it's going beyond hour= s, > so wanted to understand from experts what is the best way to achieve this= ? > > Out of curiosity, why NUMERIC(15,0) instead of BIGINT? --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --00000000000072f68a062b4874af Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jan 9, 2025 at 11:25=E2=80=AFAM v= eem v <veema0000@gmail.com>= ; wrote:
Hello,
It's = postgres version 16.1, we want to convert an existing column data type from= integer to numeric and it's taking a long time. The size of the table = is ~50GB and the table has ~150million rows in it and it's not partitio= ned. We tried running the direct alter and it's going beyond hours, so = wanted to understand from experts what is the best way to achieve this?
=


Out of cu= riosity, why NUMERIC(15,0) instead of BIGINT?=C2=A0

--
Death to <Redacted>, and but= ter sauce.
Don't boil me, I'm still alive.
<Red= acted> lobster!
--00000000000072f68a062b4874af--