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 1sSksO-009wqJ-Su for pgsql-general@arkaria.postgresql.org; Sat, 13 Jul 2024 22:05:56 +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 1sSksN-001qmA-HW for pgsql-general@arkaria.postgresql.org; Sat, 13 Jul 2024 22:05:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sSksN-001qm1-63 for pgsql-general@lists.postgresql.org; Sat, 13 Jul 2024 22:05:55 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sSksG-001unp-HS for pgsql-general@lists.postgresql.org; Sat, 13 Jul 2024 22:05:53 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 59CE719B6C; Sun, 14 Jul 2024 00:05:45 +0200 (CEST) Date: Sun, 14 Jul 2024 00:05:45 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Dropping column from big table Message-ID: <20240713220545.cgjghaggksov3xkt@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="t4huj3szjlklb37x" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --t4huj3szjlklb37x Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2024-07-11 10:06:47 +0200, Laurenz Albe wrote: > On Thu, 2024-07-11 at 13:10 +0530, sud wrote: > > Dropping will take it's own time for post vacuum however as you > > rightly said, it won't be blocking which should be fine.=A0 >=20 > I am not certain if you understood this correctly. >=20 > Dropping a column is fast, but doesn't reclaim the space. > VACUUM won't block anything, but won't reclaim the space. > VACUUM (FULL) will block everything, but will also not reclaim the space. >=20 > You'd need to use a form of ALTER TABLE that rewrites the table, > as indicated in the documentation. Unfortunately the documentation indicates very little. It mentions that the table will be rewritten with * SET ACCESS METHOD * a volatile DEFAULT * changing the type of an existing column (unless binary coercible) All three change something which you probably don't want to change. The documentation also mentions some cases where the table is not rewritten, so maybe some not explicitely mentioned options rewrite the table, too. I would especially expected ALTER TABLE ... CLUSTER to do this, but if VACUUM FULL preserves the (former) content of dropped columns, maybe CLUSTER does, too? hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --t4huj3szjlklb37x Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmaS+jMACgkQ8g5IURL+ KF3XJhAAhCKFACqBYClqyX6wna0mZs/gcVZFmF6f1wS04lIcu8g8uN7f2NF7IcLJ AI2yqAjbda4hC5FcJwMsvdjeUimowMIIMpSgnlu95KputdGt1Vu83NEpVGwD9ZTp 3o55gzjeFXSjdTtwk8E4pyKhybVsuPwZgu3+wrvFQNANfGHxNOpeUhWvG1LAMmLY FH+CplBsqftAs2AjUlTBVyrzpXQfZvaAX0HGR7J00A+YAFA17LUb7XoNDAP7I40L kax/qHoZStlQfWUvuAXjdFDIQB8bZeF+bOHu/ymmp+6RBDc+EtT/N1siwSrVayRo XF8qhe8egI2T+Ps6FjVnNZw5SvCej4l1s633qiWEvCl2aot5IILbUjSnTWa8sefY ueKRkxjfNYnHQDOJJIiSPlNiaCLoTZYkmOcHpIydqL3ynNy+k48ZE2j8IqL7MCCp XQYU61K6FGZn17GORZ/ho8j19LGdPvGZjW6MDVpG5/KovUNNDHGpOs7NVNbYj3ZP EeuuqzuVrKzrsaQin3CjrcyfD4M9Z6RxU7+vNHKhw/d0zeinaEN8KRct/YM4sUpg pSF6V6LxD1d6futav61WHxorq3vruE/Sbz86hm3F3cBZXWhRXw++S1kbxBDFD+kO 9AoIuywmBpk93bhlz3BbBi1P3BfyGZwkpchaceVEwTkf0siM8a0= =XBi1 -----END PGP SIGNATURE----- --t4huj3szjlklb37x--